Closed ifeanyiisitor closed 3 years ago
Please have a look at this codepen. It sets a custom output. I do think there are still bugs. Setting the drain does not seem to work.
I will keep this issue open for now and report back here. Thank you for your interest in ulog and taking the trouble to report issues. It is much appreciated!
Hey thanks for your reply and glad I can help. Interestingly it seems that it works in the codepen example, yet it doesn't work in my nextjs sample app. I confirmed that its ulog@2.0.0-beta.10
that I'm installing and I'm doing exactly this...
import ulog from 'ulog'
export const log = ulog('sample-app')
ulog.use({
outputs: {
custom: {
log: function (...args) {
console.dir('custom...', args)
},
},
drain: {
log: function (...args) {
console.dir('drain...', args)
},
},
},
})
ulog.set('drain', 'drain')
Note sure why it works in your codepen but not in my app. Setting ulog.set('output', 'custom')
works as expected though. So only the drain
setting is the issue.
I have redesigned the way outputs, formats and levels work together (or not!) several times. I think I just messed up between the betas.
I'm actually redesigning it yet again. I'm in the process of making static formatters (the ones that don't mess up the call stack) much more powerful and configurable. Formatters work on outputs and the drain and in the process of redesigning the formatting pipeline so it could benefit from static formatters I also am redesigning how outputs and the drain work. So please ignore the issue for the drain for a bit more; I'm working on it.
👍
@ifeanyiisitor Please check out the latest beta and let me know what you think. Feel free to re-open if you still encounter issues.
I'm trying to test out the drain functionality in the browser but I'm not sure how to set it up. This is what I tried
This didn't seem to work, and neither did doing
I'm expecting the
custom.log
function to be called but it's not being called. How would I get this to work in the browser?