Added logger name
const logger = zerg.createLogger("My lib or My App");
type TLogMessage = {
timestamp: number;
+ loggerName: string;
moduleName: string;
level: TLogLevel;
message: string;
extendedData?: TExtendedData;
};
Migration:
- Logger create
const zerg = require('zerg');
+ const logger = zerg.createLogger();
- const log = zerg.module('myAppModule');
+ const log = logger.module('myAppModule');
log.verbose('verbose message');
- Transport to console
By default zerg@2.0 don't have any listeners(transports)
const zerg = require('zerg');
+ const {consoleBrowserColorful} = require('zerg/dist/transports');
+ const listener = zerg.createListener({
+ handler: consoleBrowserColorful,
+ });
+ const logger = zerg.createLogger();
+ logger.addListener(listener);
- const log = zerg.module('myAppModule');
+ const log = logger.module('myAppModule');
log.verbose('verbose message');
Changes:
- Refactoring to TypeScript
- Remove unused code
- Refactoring listeners
- Updated README.md
- Added ability to specify levels logging for console transport
- Fixed bud with zerg.enable(['-moduleName']), it should disable only one module
- Prettified tests
- Refactored zerg.enable modules (boost)
- Returned to ES5 for support old browsers