valera
Very smart logger for node.js platform
Upgrade to v4.0.0
Valera v4 is now even faster and more convenient! No vulnerabilities and no dependencies!
- Updated pipe resolving method;
- Optimized code;
- Removed implied eval function;
- Removed unused features (inspect).
- Removed all dependencies!
Usage example
Set global configuration
; ;; Valera.configure;
Overriding console
Valera.overrideConsole; console.warn'starting in production mode'; // custom format output:// 2020-09-16T08:17:46.869Z WARN <app> starting in production mode /path/to/project/index.ts:45:17// yes, this is flexible separator "<-|->"// JSON output:// {"args":["starting in production mode"],"caller":{"fileName":"/path/to/project/index.ts","methodName":"","functionName":"","typeName":"Object","line":45,"column":17,"evalOrigin":"","isToplevel":false,"isEval":false,"isNative":false,"isConstructor":false},"date":1600244266869,"level":"debug","metadata":{"appId":"12345.app"},"name":"app"}
Changing separator mask
Record.separator = '<=!=>';Valera.configure;
Providing metadata to message
// metadata of the current message merges with the global metadataconsole.meta.warn'starting in production mode';// JSON output:// {"args":["starting in production mode"],"caller":{"fileName":"/path/to/project/index.ts","methodName":"","functionName":"","typeName":"Object","line":45,"column":17,"evalOrigin":"","isToplevel":false,"isEval":false,"isNative":false,"isConstructor":false},"date":1600244266869,"level":"debug","metadata":{"appId":"12345.app","isMaster":true},"name":"app"}
Creating new logger instance
;;
Main features
- Very flexible and easy to understand configuration
- Metadata providing
- Caller information
- Console overriding
- Typescript typings
License
Licensed under MIT license