Allow anything in the addLayout

per
 

# Adding your own layouts

You can add your own layouts by calling `log4js.addLayout(type, fn)` before calling `log4js.configure`. `type` is the label you want to use to refer to your layout in appender configuration. `fn` is a function that takes a single object argument, which will contain the configuration for the layout instance, and returns a layout function. A layout function takes a log event argument and **returns a string (usually, although you could return anything as long as the appender knows what to do with it).**
This commit is contained in:
xinbenlv 2019-03-11 21:49:06 -07:00 committed by GitHub
parent e4611e1188
commit 3d529acf2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
types/log4js.d.ts vendored
View File

@ -17,7 +17,7 @@ export function getLogger(category?: string): Logger;
export function configure(filename: string): Log4js;
export function configure(config: Configuration): Log4js;
export function addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void;
export function addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => any): void;
export function connectLogger(logger: Logger, options: { format?: Format; level?: string; nolog?: any; statusRules?: any[] }): any; // express.Handler;