diff --git a/lib/log4js.js b/lib/log4js.js index 323ce11..641adeb 100644 --- a/lib/log4js.js +++ b/lib/log4js.js @@ -111,7 +111,10 @@ function shutdown(cb) { ); if (shutdownFunctions === 0) { debug('No appenders with shutdown functions found.'); - return cb !== undefined && cb(); + if (cb) { + cb(undefined); + } + return null; } let completed = 0; diff --git a/types/log4js.d.ts b/types/log4js.d.ts index 7606fcb..cd4d8ae 100644 --- a/types/log4js.d.ts +++ b/types/log4js.d.ts @@ -17,7 +17,7 @@ export interface Log4js { options: { format?: Format; level?: string; nolog?: any } ): any; // express.Handler; levels: Levels; - shutdown(cb: (error: Error) => void): void | null; + shutdown(cb?: (error: Error | undefined) => void): null; } export function getLogger(category?: string): Logger; @@ -45,7 +45,7 @@ export function recording(): Recording; export const levels: Levels; -export function shutdown(cb?: (error: Error) => void): void | null; +export function shutdown(cb?: (error: Error | undefined) => void): null; export interface BasicLayout { type: 'basic';