diff --git a/index.d.ts b/index.d.ts index 36b64aa7b..236ce5595 100644 --- a/index.d.ts +++ b/index.d.ts @@ -169,6 +169,7 @@ declare namespace winston { let startTimer: () => Profiler; let profile: (id: string | number) => Logger; let configure: (options: LoggerOptions) => void; + let child: (options: Object) => Logger; let level: string; let exceptions: ExceptionHandler; let exitOnError: Function | boolean; diff --git a/lib/winston.js b/lib/winston.js index 7e4e29ae8..e0c4e3cac 100644 --- a/lib/winston.js +++ b/lib/winston.js @@ -104,7 +104,8 @@ Object.keys(winston.config.npm.levels) 'unhandleExceptions', 'handleRejections', 'unhandleRejections', - 'configure' + 'configure', + 'child' ]) .forEach( method => (winston[method] = (...args) => defaultLogger[method](...args)) diff --git a/test/winston.test.js b/test/winston.test.js index 30fd64ead..a24c39113 100644 --- a/test/winston.test.js +++ b/test/winston.test.js @@ -27,7 +27,7 @@ describe('winston', function () { it('has expected methods', function () { assume(winston.config).is.an('object'); - ['createLogger', 'add', 'remove', 'clear'] + ['createLogger', 'add', 'remove', 'clear', 'child'] .concat(Object.keys(winston.config.npm.levels)) .forEach(function (key) { assume(winston[key]).is.a('function', 'winston.' + key);