You could allow users to provide a user definable logger function in an 
options object. Just define in your docs how the logging callback should 
behave, i.e. it should be a callback function of the sorts function (level, 
message, metadata). 

However, think thoroughly whether you really need to perform plain logging 
(debug, info, notice) in your module. You can still return errors as your 
first callback argument (if applicable), emit "error" events or throw 
errors (but you should avoid throwing errors if possible).

All the best,

Geerten

On Wednesday, January 23, 2013 4:04:12 PM UTC+1, Nikolas Everett wrote:
>
> So I went and created a somewhat reusable component and published it in 
> npm.  It really isn't worth anyone's time at this point but it I've 
> encountered an issue.  My problem is that I want to log stuff in my module 
> so I went and included winston and logged to my little heart's content and 
> it works great in the cli application but when I embed my module I can no 
> longer control the log level.  I suppose this has something to do with 
> require's scoping to prevent library hell.  What is the standard way to 
> configure logging in libraries?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to