Create a specialized logger

This feature is provided to specialize a logger for a sub-component.
You can create a new logger with its own level and prefix for a sub-component.
The logs will be send to the same files with a prefix.

log =newlog4node.Log4Node({log_level:'warning', file:'test.log'});

sublogger1 =log.clone({prefix:'SUBMODULE - ', level:'error');

or with the default logger

sublogger1 =log4node.clone(prefix:'SUBMODULE - ', level:'error');

Mutliple instanciation

If you have a module A which depends of log4node, and a module B which also depends of log4node, you have to use only one instance, for example by giving the log4node instance of A to B.

Write callback

If you want to plug a custom transport, just specify a write_callback

log =newlog4node.Log4Node({

write_callback:function(line){

// do something with the formatted line of log.

}

});

Changelog

Version 0.1.6

Add write callback

Version 0.1.5

In cluster mode, workers open the log files in append mode instead of sending logs to the master. You can revert to the old way (always send log to master).

License

Copyright 2012 Bertrand Paquet

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.