Yeah, that is what I am thinking to do. What I would like to do in the override write method is to send those outputs to a remote logging system, which exposes some restful APIs. Considering the asynchronized working way in node.js, suppose the application performance will not be affected, e.g. bad network, bad response time and etc. Maybe, need to have codes to care about the socket.buffersize ? e.g. drop some logging records if the buffersize is greater than one configured value ?
Is there anything I should pay attention to ? Thoughts ? Thanks. On Wednesday, October 16, 2013 8:32:59 AM UTC+8, Dean Landolt wrote: > > You'll also want to `return` that `_write.apply(process.stdout, > arguments)` line. > > > On Tue, Oct 15, 2013 at 12:11 PM, Alex Kocharin > <[email protected]<javascript:> > > wrote: > >> >> var _write = process.stdout.write >> process.stdout.write = function(data) { >> // do whatever >> _write.apply(process.stdout, arguments) >> } >> >> I believe, that's about it. It shouldn't affect performance at all unless >> you're doing something silly in the write method. >> >> Also, you can fork node.js and catch the output of the child, and it's >> more flexible and less likely to break in the future versions (probably at >> the cost of a performance hit). >> >> >> 15.10.2013, 18:34, "Ivan" <[email protected] <javascript:>>: >> >> Hi, >> >> We are working on a logging system running on a paas platform, the aim >> for the system is to intercept all the messages from the stdout & stderr >> for the running node.js applications and forward to a third-party system. >> >> One possible is to override those methods in the console instance, so, >> except this, are there other better ways for this ? >> >> Thanks. >> >> >> -- >> -- >> 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]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> -- >> -- >> 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]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
