Open 1602 opened 11 years ago
great idea and get a better output log...something like this:
2010-10-02 20:39:03.570 INFO main:5 - Info message 2010-10-02 20:39:03.588 DEBUG main:6 - Debug message 2010-10-02 20:39:03.589 WARN main:7 - Warning message 2010-10-02 20:39:03.590 ERROR main:8 - Error message 2010-10-02 20:39:03.590 TRACE main:9 - Trace message 2010-10-02 20:39:03.590 INFO main:10 - Array = [ 1, 2, 3, 4 ], Object = { one: 1, two: 2 }
2010-10-02 20:59:12.496 INFO my-modules/first:3 - Message from first module from line #3
2010-10-02 20:59:12.514 INFO my-modules/second:10 - Message from second module from line #10
2010-10-02 20:59:12.515 INFO fake-module-name:3 - Message from third module from line #3
2010-10-02 20:59:12.516 INFO
maybe you can follow something like this https://github.com/nomiddlename/log4js-node!
This is badly needed. As it stands, the importance of messages is completely lost. Worse, I can't do anything but pipe output to files in production. For levels, a minimum of debug
, info
, warn
, and error
are needed.
A quick solution would be to have a toggle to turn off or off default logging to stdio (this can still be the default), and have the logger object be an event emitter (perhaps name error
to something else though). This will provide a simple interface for a developer to feed into another logging service such as winston or bunyan for maximum flexibility.
Replace app.enable('quiet') with two options: