Git Product home page Git Product logo

node-tech-logger's People

Contributors

arenoux avatar comepasto avatar jcombes avatar jlescot avatar kinfoo avatar phtrivier avatar sebz avatar sgaestel avatar

Watchers

 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  avatar  avatar  avatar  avatar  avatar  avatar

node-tech-logger's Issues

Make "levels" working the right way

Looking at Winston documentation about Logging levels (https://github.com/winstonjs/winston#logging-levels) and the documentation on Syslog protocol (https://fr.wikipedia.org/wiki/Syslog#Niveau_de_gravité) it seems that we are defining levels the wrong way: https://github.com/AirVantage/node-tech-logger/blob/master/techLogger.js#L18-L30

Seems that we had some troubles to set up that:

// Winston levels correctly ordered
// DO NOT TRUST Winston level definition as it does not comply to a "logical" threshold mechanism
const LEVELS_CONFIG = {
  levels: {
    emerg: 7,
    alert: 6,
    crit: 5,
    error: 4,
    warn: 3,
    notice: 2,
    info: 1,
    debug: 0
  }
};

😅

⚠️ The previous behavior has changed on Winston side since 2.x: see winstonjs/winston#406 & winstonjs/winston@438331a

So it might be an opportunity to migrate to a newer Winston version (3.x)?

At the same time, we noticed that when calling logger.warn() the message was available on Cloudwatch, but not on Loggly side... could be linked to the erratic previous behavior.
Just for information, we had to fix this bug previously, see 7af07cc

Error objects are not logged correclty

Today, we use JSON.stringify to log Objects... This lead to the following result for errors:

var logger = require("node-tech-logger");
logger.error(new Error("error message"));

>> error: [module.js] {}

We should handle Error object differently and log error message and stack.

Support for "local" loggers

I think it would be nice to be able to do something like :

// in file like techFoo.js of node-tech-foo

var logger  = require("node-tech-logger").prefixed("tech-foo");

... 

logger.debug("Some message");

And the "local" function would return a wrapped logger that would simply prefix all messages so that you get :

debug : [tech-foo] Some message

(Or maybe even file info if it make sense :

var logger  = require("node-tech-logger").prefixed("tech-foo", __dirname);
debug : [tech-foo] [techFoo.js] Some message

Is that something that winston / whatever supports out of the box ?

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.