A good reporter to send and log events with winston
$ npm install --save hapi-good-winston
import { Server } from 'hapi';
import winston from 'winston';
import goodWinston from 'hapi-good-winston';
const server = new Server();
server.connection();
// Set winston minimum log level to debug
winston.level = 'debug';
// Only the 'response' and 'error' event levels will be overwritten
const goodWinstonOptions = {
levels: {
response: 'debug',
error: 'info',
}
};
const options = {
reporters: {
// Simple and straight forward usage
winston: [goodWinston(winston)],
// Adding some customization configuration
winstonWithLogLevels: [goodWinston(winston, goodWinstonOptions)],
// This example simply illustrates auto loading and instantiation made by good
winston2: [{
module: 'hapi-good-winston',
name: 'goodWinston',
args: [winston, goodWinstonOptions],
}],
},
};
server.register({
register: require('good'),
options,
}, (err) => {
if (err) {
return console.error(err);
}
server.start(() => {
console.info(`Server started at ${server.info.uri}`);
});
});
- Adding custom log levels to offer the possibility of using winston's custom log levels
- [] Filtering events
- [] Adding message customization
- [] Adding message templating