@voiceflow/logger
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -7,10 +7,10 @@ import { HttpLogger } from 'pino-http'; | ||
constructor(config?: LoggerConfig); | ||
trace(...params: [any, ...any[]]): void; | ||
debug(...params: [any, ...any[]]): void; | ||
info(...params: [any, ...any[]]): void; | ||
warn(...params: [any, ...any[]]): void; | ||
error(...params: [any, ...any[]]): void; | ||
fatal(...params: [any, ...any[]]): void; | ||
trace(message: unknown): void; | ||
debug(message: unknown): void; | ||
info(message: unknown): void; | ||
warn(message: unknown): void; | ||
error(message: unknown): void; | ||
fatal(message: unknown): void; | ||
logMiddleware(): HttpLogger; | ||
} | ||
export default Logger; |
@@ -35,19 +35,19 @@ "use strict"; | ||
} | ||
trace(...params) { | ||
this.logger.trace(...params); | ||
trace(message) { | ||
this.logger.trace(message); | ||
} | ||
debug(...params) { | ||
this.logger.debug(...params); | ||
debug(message) { | ||
this.logger.debug(message); | ||
} | ||
info(...params) { | ||
this.logger.info(...params); | ||
info(message) { | ||
this.logger.info(message); | ||
} | ||
warn(...params) { | ||
this.logger.warn(...params); | ||
warn(message) { | ||
this.logger.warn(message); | ||
} | ||
error(...params) { | ||
this.logger.error(...params); | ||
error(message) { | ||
this.logger.error(message); | ||
} | ||
fatal(...params) { | ||
this.logger.fatal(...params); | ||
fatal(message) { | ||
this.logger.fatal(message); | ||
} | ||
@@ -54,0 +54,0 @@ logMiddleware() { |
@@ -41,24 +41,24 @@ import pino, { Logger as PinoLogger, LoggerOptions } from '@voiceflow/pino'; | ||
trace(...params: [any, ...any[]]): void { | ||
this.logger.trace(...params); | ||
trace(message: unknown): void { | ||
this.logger.trace(message as any); | ||
} | ||
debug(...params: [any, ...any[]]): void { | ||
this.logger.debug(...params); | ||
debug(message: unknown): void { | ||
this.logger.debug(message as any); | ||
} | ||
info(...params: [any, ...any[]]): void { | ||
this.logger.info(...params); | ||
info(message: unknown): void { | ||
this.logger.info(message as any); | ||
} | ||
warn(...params: [any, ...any[]]): void { | ||
this.logger.warn(...params); | ||
warn(message: unknown): void { | ||
this.logger.warn(message as any); | ||
} | ||
error(...params: [any, ...any[]]): void { | ||
this.logger.error(...params); | ||
error(message: unknown): void { | ||
this.logger.error(message as any); | ||
} | ||
fatal(...params: [any, ...any[]]): void { | ||
this.logger.fatal(...params); | ||
fatal(message: unknown): void { | ||
this.logger.fatal(message as any); | ||
} | ||
@@ -65,0 +65,0 @@ |
{ | ||
"name": "@voiceflow/logger", | ||
"description": "Common logger for Voiceflow backend microservices", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"author": "Frank Gu <frank@voiceflow.com>", | ||
@@ -71,8 +71,9 @@ "bugs": { | ||
"prepare": "yarn build", | ||
"test": "NODE_ENV=test nyc ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.{unit,it}.{ts,js}'", | ||
"test": "yarn test:run", | ||
"test:run": "NODE_ENV=test nyc ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.{unit,it}.{ts,js}'", | ||
"test:dependencies": "depcheck", | ||
"test:integration": "NODE_ENV=test nyc ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.it.{ts,js}'", | ||
"test:integration": "NODE_ENV=test nyc --report-dir nyc_coverage_integration ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.it.{ts,js}'", | ||
"test:single": "NODE_ENV=test nyc ts-mocha --paths --opts ./config/tests/mocha.opts", | ||
"test:unit": "NODE_ENV=test nyc ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.it.{ts,js}'" | ||
"test:unit": "NODE_ENV=test nyc --report-dir=nyc_coverage_unit ts-mocha --paths --opts ./config/tests/mocha.opts 'tests/**/*.unit.{ts,js}'" | ||
} | ||
} |
@@ -0,1 +1,4 @@ | ||
[](https://circleci.com/gh/voiceflow/logger) | ||
[](https://sonarcloud.io/dashboard?id=voiceflow_logger) | ||
[](https://sonarcloud.io/dashboard?id=voiceflow_logger) | ||
# logger | ||
@@ -15,5 +18,7 @@ | ||
```javascript | ||
const Logger = require('@voiceflow/logger'); | ||
const Logger = require('@voiceflow/logger').default; | ||
// or | ||
import Logger from '@voiceflow/logger'; | ||
defaultOptions = { | ||
const defaultOptions = { | ||
level: 'info', | ||
@@ -23,3 +28,3 @@ pretty: false, | ||
overrideOptions = { | ||
const overrideOptions = { | ||
level: 'trace', // Minimum log-level to be printed | ||
@@ -29,11 +34,11 @@ pretty: true, // Pretty print | ||
const defaultlogger = new Logger(); // Default options | ||
const defaultLogger = new Logger(); // Default options | ||
const customLogger = new Logger(overrideOptions); | ||
defaultlogger.trace('this is a trace'); | ||
defaultlogger.debug('this is a debug'); | ||
defaultlogger.info('this is an info'); | ||
defaultlogger.warn('this is a warning'); | ||
defaultlogger.error('this is an error'); | ||
defaultlogger.fatal('this is a fatal'); | ||
defaultLogger.trace('this is a trace'); | ||
defaultLogger.debug('this is a debug'); | ||
defaultLogger.info('this is an info'); | ||
defaultLogger.warn('this is a warning'); | ||
defaultLogger.error('this is an error'); | ||
defaultLogger.fatal('this is a fatal'); | ||
@@ -40,0 +45,0 @@ customLogger.trace('this is a trace'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
40424
58
1