wood1986 / ln Goto Github PK
View Code? Open in Web Editor NEWThe SUPER BEST JSON file logging library for Node.js
The SUPER BEST JSON file logging library for Node.js
Hello,
The ln console output displays an extra newline per line of text, which makes it unsightly and less readable. The JSON output, on the other hand, is data intended to be read programmatically, thus doesn't necessarily need the carriage return.
Removing the "\n" (or switching appender.write, and selectively appending the "\n" for file output only) would resolve this issue.
I did not see any documented setting allowing users to specify if the console appender should log to STDOUT or STDERR.
I got below error when I tried to log with cluster. I might be making some mistake. Can you please provide a sample example for logging with cluster/workers.
Error: ENOENT, open '../logs/error/log.1506011842' at Error (native) events.js:85 throw er; // Unhandled 'error' event
Clever code, thanks for this.
If you were to queue your log strings when the user calls log.info(...)
rather than on the emit('log', ...)
, you could achieve a reduction in number of calls to stream.write
, right?
Thanks for the great work!
I have a appender for Logentries (https://logentries.com/) and for this JSON string is perfect. However, I like to log only messages to console, not entire JSON string.
It would be great if it is up to appender to decide what format to render JSON object.
Another justification is that I need to access "level" of logging. In order to achieve this, I need to parse JSON string, which is unnecessarily expensive operation if it was JSON object, with the current implementation.
For example, I should be able to do something like this if it was JSON object:
appender_logentries.emitter.on("log", function (appender, timestamp, log) {
logger_logentries.log(log.l, JSON.stringify(log))
});
appender_console.emitter.on("log", function (appender, timestamp, log) {
if(log.l === 10) console.log(log.m)
if(log.l === 20) console.warn(log.m)
if(log.l === 30) console.error(log.m)
...
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.