Shutdown cb arg can be undefined + always return null

This commit is contained in:
Richard Hinkamp 2021-06-09 21:19:38 +02:00
parent f8d46a9392
commit fc1ccbeb41
2 changed files with 6 additions and 3 deletions

View File

@ -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;
}
appendersToCheck.filter(a => a.shutdown).forEach(a => a.shutdown(complete));

4
types/log4js.d.ts vendored
View File

@ -9,7 +9,7 @@ export interface Log4js {
addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void;
connectLogger(logger: Logger, 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;
@ -23,7 +23,7 @@ export function connectLogger(logger: Logger, options: { format?: Format; level?
export const levels: Levels;
export function shutdown(cb?: (error: Error) => void): void | null;
export function shutdown(cb?: (error: Error | undefined) => void): null;
export interface BaseLayout {
type: 'basic';