Socket.io's logger is pluggable

On Wednesday, July 11, 2012, Elad Ben-Israel wrote:

>
>
> On Wed, Jul 11, 2012 at 5:25 PM, Matt <hel...@gmail.com<javascript:_e({}, 
> 'cvml', 'hel...@gmail.com');>
> > wrote:
>
>> On Tue, Jul 10, 2012 at 6:17 PM, Elad Ben-Israel <
>> elad.benisr...@gmail.com <javascript:_e({}, 'cvml',
>> 'elad.benisr...@gmail.com');>> wrote:
>>
>>> Not sure exactly what use case Gaurav is interested in, but I was
>>> interested in this thread because I think there is an unmet need around
>>> logging which domain-attached context could help solve (even a single
>>> pointer to a global instance). Logs are emitted everywhere across
>>> application (and library) stack and in node, mostly via `console.xxx`. One
>>> useful feature would be to allow, for example, correlating all console logs
>>> emitted during the processing of an incoming request. A few logging
>>> libraries do allow pushing context but they all require passing along some
>>> state throughout the async hoops, which means modifying the way logging is
>>> done throughout the entire stack.
>>>
>>
>> Well yes, you can't use console.log(), but "Don't Do That" anyway, it's
>> bad practice. Look at how Haraka does logging - every log line gets a UUID
>> associated with the current connection/transaction. It has made tracing
>> issues with mail at Craigslist an absolute dream.
>>
>>
> Haraka is awesome but it has the privilege of being a 'mini ecosystem'
> where plugins must adhere to the Haraka environment (in which case, use the
> Haraka `this.logxxx()` functions which emit the request UUID by extracting
> them from the current context in `this`).
>
> Now say you would want to create a Hakara plugin that used a library like
> socket.io for example (just an example) which emits it's own logs - now
> what do you do? You will need to pass the Haraka `this` pointer all the way
> to every log callsite in the socket.io codebase. Not very practical.
>
>
>
>> Matt.
>>
>
>
>
> --
> Elad.
>


-- 
Guillermo Rauch
LearnBoost CTO
http://devthought.com

Reply via email to