Logger
Logger class.
new Logger()
License: https://opensource.org/licenses/MIT
Author: Patrick Heng & Fabien Motte <hengpatrick.pro@gmail.com / contact@fabienmotte.com>
Example
const logger = new Logger()
logger.log('Test')
Instance Members
Enable logging.
Returns
Logger
:
this
Disable logging.
Returns
Logger
:
this
Reset levels and plugins.
reset()
Line break.
Returns
Logger
:
this
Add/modify a level.
Parameters
options (Object
= {}
)
Level options.
Returns
Logger
:
this
▸
plugin(name, fn, options)
Add/modify a plugin.
Parameters
fn ((Function | Object))
Plugin callback function/plugin options if plugin already exists.
options (Object
= {}
)
Plugin options.
Returns
Logger
:
this
Set log handler.
Parameters
Returns
Logger
:
this
namespace
Namespace plugin.
Parameters
options (Object
= {}
)
Plugin options.
Name |
Description |
options.name String
(default null )
|
Namespace name.
|
options.capitalize Boolean
(default false )
|
Capitalize.
|
options.styles Object
(default {} )
|
Plugin styles.
|
Name |
Description |
level.name String
|
Level name.
|
level.options Object
|
Level options.
|
Returns
Object
:
Plugin result.
time
Time plugin.
Parameters
options (Object)
Plugins options.
Name |
Description |
level.name String
|
Level name.
|
level.options Object
|
Level options.
|
Returns
Object
:
Plugin result.
camelToKebab
Camel to kebab case.
Parameters
Returns
String
:
Parsed string.
capitalize
Capitalize.
Parameters
Returns
String
:
Capitalized string.