1.0.1 • Published 7 years ago
@fyzu/logger v1.0.1
Install
npm i -D @fyzu/logger
⚠️ We do not recommend installing this module globally
Usage
const createLogger = require('@fyzu/logger')
const logger = createLogger({ name: 'wds' })
logger.info('Server Starting')
Options
Name | Type | Default | Description |
---|---|---|---|
name | {String} | ''<unknown>' | Log Name (Required) |
level | {String} | 'info' | Log Level |
unique | {String} | true | Log Uniqueness |
timestamp | {Boolean} | false | Log Timestamps |
name
Specifies the name of the log to create. This option is required, and used to differentiate between loggers when webpack-log
is used in multiple projects
executing in the same process
const logger = createLogger({ name: 'wds' })
level
Specifies the level the logger should use. A logger will not produce output for any log level beneath the specified level. Available levels and order are:
[
'info',
'warn',
'error',
'trace',
'debug',
'silent'
]
const logger = createLogger({ level: 'error' })
logger.error(err)
ℹ️ The level names shown above correspond to the available logging methods, with the notable exception of the
silent
level
timestamp
If true
, instructs the logger to display a timestamp for log output, preceding
all other data
const logger = createLogger({ timestamp: true })