Skip to content

Allow anything in the addLayout#845

Merged
nomiddlename merged 1 commit intolog4js-node:masterfrom
xinbenlv:patch-1
May 1, 2019
Merged

Allow anything in the addLayout#845
nomiddlename merged 1 commit intolog4js-node:masterfrom
xinbenlv:patch-1

Conversation

@xinbenlv
Copy link
Copy Markdown
Contributor

@xinbenlv xinbenlv commented Mar 12, 2019

per https://github.com/log4js-node/log4js-node/blob/master/docs/layouts.md

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).

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).**
@xinbenlv
Copy link
Copy Markdown
Contributor Author

This should be backward compatible and should not break anyone's test

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2019

Codecov Report

Merging #845 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #845   +/-   ##
=======================================
  Coverage   97.43%   97.43%           
=======================================
  Files          25       25           
  Lines         937      937           
=======================================
  Hits          913      913           
  Misses         24       24

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e4611e1...3d529ac. Read the comment docs.

@nomiddlename nomiddlename added this to the 4.1.1 milestone May 1, 2019
@nomiddlename
Copy link
Copy Markdown
Collaborator

Thanks for this.

@nomiddlename nomiddlename merged commit 04c385c into log4js-node:master May 1, 2019
@nomiddlename
Copy link
Copy Markdown
Collaborator

Published to NPM in [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants