Hacker News new | ask | show | jobs
by jbail 4585 days ago
I just pushed an updated Lumberjack using constructors. Take a peek: https://github.com/jbail/lumberjack

I need to update the Readme to show doing stuff like: var cat = console.stream('cat'); cat.info('Meow'); cat.warn('Hiss!'); But, that should work now. I really like being able to do that. Thanks for the suggestion.

Next steps...I'm not sure. I'm going to put this in place at my day job tomorrow and see how it feels in production use. I was thinking it might be cool to append/color the console with the stream name. Again, just to make the console even easier to read if you do have a ton of streams getting logged concurrently.

Prefixing messages could be cool too. Now with the Console constructor, you sort of have a parent/child relationship. As long as the stream is a child of the parent, it would work. Are you thinking something like this?

cat = console.stream('cat');

boobie = cat.stream('boobie'); karl = cat.stream('karl');

cat.log('boobie:meow'); cat.log('karl:hiss');

I'm not sure how that holds up when you want to log objects or arrays. What do you envision? Let me know.

Thanks again for the comments. This is the first time I've open sourced anything I've written. Getting feedback and hearing how other people might use it and what they do and don't like about my code has been awesome. It's already made this little utility way better than it started and its only been out in the wild for 24 hours.

1 comments

Replying to myself to say that I added color support. If you're using Firefox or Chrome (which I believe are the only two browsers that support color in the console at this time), then your stream names will be printed in color. This really helps the console to pop and be more legible. You can view a demo here: http://jbail.github.io/lumberjack/demo.html