Merge pull request #1082 from richardhinkamp/shutdown-type-consistent

Shutdown cb arg can be undefined + always return null
This commit is contained in:
Lam Wei Li 2022-09-03 00:10:50 +08:00 committed by GitHub
commit 6a60294611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}
let completed = 0;

4
types/log4js.d.ts vendored
View File

@ -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';