ww24 / log4js-node-extend

log4js + line number
Apache License 2.0
28 stars 9 forks source link
log4js nodejs

log4js-node-extend Build Status Dependency Status

It add useful meta data of code (file-name, function-name line-number, column-number) for log4js-node.

Example

[2014-02-18 12:24:14.238] [INFO] category - test at <anonymous> (test.js:57:9)

Installation

npm install log4js-extend

Usage

const log4js = require("log4js");
const log4js_extend = require("log4js-extend");

log4js_extend(log4js, {
  path: __dirname,
  format: "at @name (@file:@line:@column)"
});

const logger = log4js.getLogger("category");
logger.info("test");

Options

path

Use relative path from path directory.

default: null

format

Simple log format.

default: "at @name (@file:@line:@column)"

Keywords will replace as below.