@musicplayer/logger-module
v1.1.2
Published
Logger module to use logging microservice
Downloads
2
Readme
Logger module to use in musicplayer microservice environment
NPM package, which can be used in the musicplayer repository.
Usage
import { Logger, log_error } from '@musicplayer/logger-module';
// Address of the logger microservice
const useHttps = true;
const host = host;
const port = port;
const version = 1;
// Name of the service, on which the module is used
const serviceName = 'serviceName';
const logger = new Logger(useHttps, host, port, version, serviceName);
logger.start();
// Create log files to log service and request messages (optional)
open_service_file();
open_request_file('request_number');
// Log messages
log_error('request_number', 'message');
log_error('request_number', new Error('error_message'));
// Close the open file handles for the request and service log file
close_request_file('request_number');
close_service_file();
logger.stop();
Available function to handle log files
- open_service_file
- open_request_file
- close_service_file
- close_request_file
Available functions to log messages
- log_error
- log_warn
- log_info
- log_verbose
- log_debug
- log_silly