Open ourarash opened 5 years ago
@ourarash Have you looked into this: https://github.com/xpl/ololog#adding-custom-helper-methods ?
Try that code:
log = require ('ololog')
.configure (/* YOUR CONFIG HERE */)
.methods ({
severity (n) { return this.configure ({ tag: { severity: n } }) })
})
This will allow you to do this:
log.severity(5).info('This is my message')
I was able to hack a severity level so that a message only prints if its severity is above the min severity level. This is useful when for example you run the program in a verbose vs non-verbose mode.
Here is what worked for me:
However, this is ugly. Ideally, it should be like this: