From bec0d058470263f957def32c07cbd35076edf0f3 Mon Sep 17 00:00:00 2001 From: Jan Schmidle Date: Fri, 8 Feb 2013 16:15:51 +0100 Subject: [PATCH] added some documentation to the function header --- lib/layouts.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/layouts.js b/lib/layouts.js index dc6c2dd..aed65b8 100644 --- a/lib/layouts.js +++ b/lib/layouts.js @@ -140,9 +140,22 @@ function messagePassThroughLayout (loggingEvent) { * - %d date in various formats * - %% % * - %n newline + * - %x{} add dynamic tokens to your log. Tokens are specified in the tokens parameter * You can use %[ and %] to define a colored block. - * Takes a pattern string and returns a layout function. + * + * Tokens are specified as simple key:value objects. + * The key represents the token name whereas the value can be a string or function + * which is called to extract the value to put in the log message. If token is not + * found, it doesn't replace the field. + * + * A sample token would be: { "pid" : function() { return process.pid; } } + * + * Takes a pattern string, array of tokens and returns a layout function. + * @param {String} Log format pattern String + * @param {object} map object of different tokens + * @return {Function} * @author Stephan Strittmatter + * @author Jan Schmidle */ function patternLayout (pattern, tokens) { var TTCC_CONVERSION_PATTERN = "%r %p %c - %m%n";