nomiddlename/log4js-node — pull request #222 by dwelch2344 (2014-07-27 04:46:36+00:00)
Title: Export Logger and LoggingEvent for easy customization

TLDR: Export Logger and LoggingEvent so customization (like line numbers) can easily be implemented.

It's really useful to be able to see the originating file and line number when developing. I know this has performance impacts, but if the client code had access to the Logger and LoggingEvent objects, we could easily make that call on our own.

A simple example (abstracted from #73) shows how this could work in most smaller apps.

```js
var log4js = require('log4js')
, logger = log4js.getLogger()
, sh = require("shelljs")
, cwd = sh.pwd()
;

log4js.Logger.prototype.log = function() {

var stack = new Error().stack.split('\n');
var location = stack[3].match(/:([0-9]+):([0-9]+)\)$/);
var file = stack[3].match(/.*\(([^:]+).*/)[1].replace(cwd + '/', "");
var category = this.category;
if (location) {
category += ':' + file + ':' + location[1] + ':' + location[2];
}

var args = Array.prototype.slice.call(arguments)
, logLevel = args.shift()
, loggingEvent = new log4js.LoggingEvent(category, logLevel, args, this);
this.emit("log", loggingEvent);
};

logger.info("Hello World!");
```

results in
```
[2014-07-26 22:41:30.227] [INFO] [default]:test.js:23:8 - Hello World!
```

It's a pretty trivial change (although it does expose internals) so I haven't written any tests, but I think any exposure to these two objects would suffice.

Thoughts?