A logging server built on top of winston and hapi.js, capable of receiving and querying logs.
Each winstond server can utilize up to 2 different services, which leverage the main capabilities of a winston transport.
collect
- log collectionquery
- querying logs
const happyWinston = require('happy-winston')
const server = new happyWinston.Winstond()
server.add(happyWinston.transports.Console, {
colorize: true,
timestamp: true,
stringify: true,
prettyPrint: true
})
server.add(happyWinston.transports.File, {
filename: 'newbie.log'
})
server.listen()
server.on('listening', () => {
console.log('server starts on 127.0.0.1:9003')
})
const winston = require('winston')
winston.add(winston.transports.Http, {
host: '127.0.0.1',
port: 9003
})
winston.log('info', 'hello')
winston.log('info', 2)
winston.query({
from: new Date() - 24 * 60 * 60 * 1000,
until: new Date(),
limit: 10,
start: 0,
order: 'desc'
}, (err, results) => {
if (err) {
console.log(err)
} else {
if (results.http.file) {
for (let r of results.http.file) {
console.log(r)
}
}
}
})
winstond supports http backend.
$ npm install happy-winston