From d64d4ca0caee824a367383eacdc7c8ef10aa7251 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 15 Jul 2011 09:13:09 +1000 Subject: [PATCH] updated to remove TODO and credit danbell --- README.md | 10 ++-------- lib/layouts.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 820b313..c0ce34a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a conversion of the [log4js](http://log4js.berlios.de/index.html) framework to work with [node](http://nodejs.org). I've mainly stripped out the browser-specific code and tidied up some of the javascript. It includes a basic file logger, with log rolling based on file size, and also replaces node's console.log functions. -NOTE: in v0.2.x require('log4js') returned a function, and you needed to call that function in your code before you could use it. This was to make testing easier. v0.3.x make use of [felixge's sandbox-module](https://github.com/felixge/sandbox-module), so we don't need to return a function. +NOTE: in v0.2.x require('log4js') returned a function, and you needed to call that function in your code before you could use it. This was to make testing easier. v0.3.x make use of [felixge's sandbox-module](https://github.com/felixge/node-sandboxed-module), so we don't need to return a function. ## installation @@ -55,15 +55,9 @@ configuration file (`log4js.configure('path/to/file.json')`) explicitly, or just An example file can be found in `test/log4js.json`. An example config file with log rolling is in `test/with-log-rolling.json` You can also pass an object to the configure function, which has the same properties as the json versions. -## todo - -patternLayout has no tests. This is mainly because I haven't found a use for it yet, -and am not entirely sure what it was supposed to do. It is more-or-less intact from -the original log4js. - ## connect/express logger -A connect/express logger has been added to log4js. This allows connect/express servers to log using log4js. See example-connect-logger.js. +A connect/express logger has been added to log4js, by [danbell](https://github.com/danbell). This allows connect/express servers to log using log4js. See example-connect-logger.js. var log4js = require('./lib/log4js'); log4js.addAppender(log4js.consoleAppender()); diff --git a/lib/layouts.js b/lib/layouts.js index 57a231a..3a77aa0 100644 --- a/lib/layouts.js +++ b/lib/layouts.js @@ -120,7 +120,16 @@ function messagePassThroughLayout (loggingEvent) { /** * PatternLayout - * + * Format for specifiers is %[padding].[truncation][field]{[format]} + * e.g. %5.10p - left pad the log level by 5 characters, up to a max of 10 + * Fields can be any of: + * - %r time in toLocaleTimeString format + * - %p log level + * - %c log category + * - %m log data + * - %d date in various formats + * - %% % + * - %n newline * Takes a pattern string and returns a layout function. * @author Stephan Strittmatter */