loglevel-timestamp
v1.0.2
Published
Prepends a timestamp to your loglevel messages with some extra :sparkle:
Downloads
4,681
Maintainers
Readme
loglevel-timestamp
Prepends a timestamp to your loglevel messages with some extra ✨.
Example
This can be used in node or in browser (see browser support).
prefixer(log, {
shouldLevel: true,
prefixStart: '[',
prefixEnd: ']'
});
log.info('App started');
// [ 2016-08-19T17:31:00.230Z INFO ] App started
Options
shouldTimestamp
Boolean
- Default:true
Use this to control if timestamp appears.
shouldLevel
'Boolean' - Default: 'false'
Use this to define if log level should be displayed.
Example:
2016-08-19T17:31:00.230Z INFO App started
prefixStart
String
- Default: noneThis gets appended before the prefix.
prefixEnd
String
- Default: noneThis gets appended after the prefix.
prefixes
Array
- Default: noneThis are items that are displayed after the timestamp and log level. You can use functions here.
Todo
- [ ] Browser tests
- [ ] Node tests
- [ ] SemaphoreCI
- [ ] Code climate
- [ ] User defined functions with custom context
- [ ] Reordering built-in prefixers in log
Browser support
This will not work in IE <=9!