airvantage / node-tech-logger Goto Github PK
View Code? Open in Web Editor NEWWraps Winston logger to provide a high level API
License: MIT License
Wraps Winston logger to provide a high level API
License: MIT License
Leads to the following warning in logs :
failure|fail|error() is deprecated and will be removed in 2.1, please use promise-style instead.
See https://github.com/sequelize/sequelize/wiki/Upgrading-to-2.0#promises-replaces-eventemitter
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
}
};
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
It is just required to get the application name...
For instance:
[techLogger.js] Will use count and duration var nb_http_core dur_http_core
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.
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 ?
Today, the splash function log all configuration.
For production, we should not show passwords/secrets
winston
: 0.8 => 3.2.1winston-syslog
: 1.2.5 => 2.0Using logger.warn
does not log anything...
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.