var log = require('hlogger').createLogger("name");
log.info("test");
Simple pet project that contains ways to create new Writers, Adapters
The way developer issues logging
log.info("info log");
log.error("error log");
log.warn("warning log");
log.verb("verbose log");
Log filtering, adapters can be created to receive only error, warning logs
Attached to adapter, writers will be responsible to write the logs either files, console, sql, socket
Right now only two predefined loggers availalbe: file and console
Formats for adapters:
Simple:
{
"writers":{
"myconsole": {
"writer":"console"
}
},
"loggers": {
"main":["ERROR","VERBOSE","INFO","WARN"]
},
"adapters" : [
{
"levels": ["INFO","VERBOSE","WARN","ERROR"],
"writers": ["myconsole"],
"loggers": {
"Hello": ["INFO"],
"main": ["ERROR"]
}
}
]
}
Create a set of writers, and setup adapters using those writers
{
"writers" : {
"filetolog":{
"writer":"file",
"opts":{
"path":"access.log"
}
},
"errorfile": {
"writer":"file",
"opts": {
"path":"error.log"
}
},
"console1": {
"writer":"console",
"opts":{
"format":{
"ERROR":"-------------- ERR %m -----------------"
}
}
},
"console": {
"writer":"console"
}
},
"adapters" : [
{
"levels": ["INFO","VERBOSE"],
"writers": ["filetolog","console"]
},
{
"levels":["ERROR","WARN"],
"writers": ["errorfile","console1"]
}
]
}