uor-logging
v1.0.0
Published
Logging module for UOR projects
Downloads
11
Readme
uor-logging
A standardized logging module for UOR projects based on Winston.
Installation
npm install uor-loggingUsage
Basic Usage
const logger = require('uor-logging');
// Log messages with different levels
logger.debug('Debug message');
logger.info('Info message');
logger.warn('Warning message');
logger.error('Error message');
logger.error(new Error('Error with stack trace'));Custom Configuration
You can create a custom logger with specific configuration:
const { createLogger } = require('uor-logging');
const customLogger = createLogger({
logDir: 'custom-logs', // Custom directory for log files
level: 'info', // Minimum log level
console: true, // Enable console logging
file: true // Enable file logging
});
customLogger.info('This is a custom logger');Configuration Options
| Option | Type | Default | Description | |--------|------|---------|-------------| | logDir | string | 'logs' | Directory to store log files | | level | string | 'debug' | Minimum log level ('error', 'warn', 'info', 'debug') | | console | boolean | true | Enable logging to console | | file | boolean | true | Enable logging to files |
Log Files
When file logging is enabled, logs are written to:
combined.log- Contains all log messageserror.log- Contains only error level messages
License
ISC
