Coder Social home page Coder Social logo

ln's People

Contributors

rmg avatar wood1986 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ln's Issues

Newline in console vs. file output

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.

Cluster Error

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

Performance question

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?

Pass JSON object, instead of JSON string, as emitter#on parameter

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)
...
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.