Skip to content

Instantly share code, notes, and snippets.

@gcoonrod
Created January 7, 2016 18:51
Show Gist options
  • Save gcoonrod/c49fce9d68b382cb76f4 to your computer and use it in GitHub Desktop.
Save gcoonrod/c49fce9d68b382cb76f4 to your computer and use it in GitHub Desktop.
Custom Logging Levels in AH 12.4
exports.default = {
logger: function(api) {
var logger = {
transports: []
};
logger.transports.push(function(api, winston) {
return new(winston.transports.Console)({
colorize: true,
level: 'info',
timestamp: true,
handleExceptions: true,
humanReadableUnhandledException: true,
exitOnError: false
});
});
var levels = {
"trace": 0,
"debug": 1,
"info": 2,
"notice": 3,
"warning": 4,
"error": 5,
"crit": 6,
"alert": 7,
"emerg": 8
};
var colors = {
"trace": "magenta",
"debug": "blue",
"info": "green",
"notice": "yellow",
"warning": "red",
"error": "red",
"crit": "red",
"alert": "yellow",
"emerg": "red"
};
logger.levels = levels;
logger.colors = colors;
return logger;
}
};
@gcoonrod
Copy link
Author

gcoonrod commented Jan 7, 2016

Using this configuration for the AH logger I see log entries at all logging levels instead of just at info and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment