1.1.14 • Published 2 years ago
@voicenter-team/amqp-logger v1.1.14
amqp-logger
Logger which should not kill process on channel fail
let logConfig = {
"log_amqp": [
{
"connection": {
"host": "127.0.0.1",
"port": 5672,
"ssl": false,
"username": "user",
"password": "password",
"vhost": "/",
"heartbeat": 5
},
"channel": {
"directives": "ae",
"exchange_name": "TestE",
"exchange_type": "fanout",
"exchange_durable": true,
"topic": "",
"options": {}
}
},
{
"connection": {
"host": "127.0.0.1",
"port": 5672,
"ssl": false,
"username": "test",
"password": "password",
"vhost": "/",
"heartbeat": 5
},
"channel": {
"directives": "ae",
"exchange_name": "TestExchange",
"exchange_type": "fanout",
"exchange_durable": true,
"topic": "",
"options": {}
}
},
{
"connection": {
"host": "127.0.0.1",
"port": 5672,
"ssl": false,
"username": "test",
"password": "password",
"vhost": "/",
"heartbeat": 5
},
"channel": {
"directives": "ae",
"exchange_name": "TestExchange1",
"exchange_type": "fanout",
"exchange_durable": true,
"topic": "",
"options": {}
}
},
{
"connection": {
"host": "127.0.0.1",
"port": 5672,
"ssl": false,
"username": "test",
"password": "password",
"vhost": "/",
"heartbeat": 5
},
"channel": {
"directives": "ae",
"exchange_name": "TestExchange2",
"exchange_type": "fanout",
"exchange_durable": true,
"topic": "",
"options": {}
}
}
],
"pattern": {
"DateTime": "",
"Title": "",
"Message": "",
"LoggerSpecificData": "localhost",
"LogSpecificData": "ThisLogType"
},
"meth_dict": {
"fatal": 0,
"error": 1,
"warn": 2,
"info": 3,
"debug": 4,
"trace": 5
},
"log_lvl": 3,
"self_log_lvl": 3
};
let logger = require('./index').pastash(logConfig);
setInterval(() => {
logger.fatal("Hello!!!");
logger.fatal({Data: "test"});
logger.fatal({Message: "Hello!!!", Data: "test"});
}, 3000);
Winston Transport
const winston = require('winston');
const amqpLogger = require("@VoicenterTeam/amqp-logger");
let transport = amqpLogger.winstonTransport();
const logger = winston.createLogger({
level: 'info',
format: winston.format.json(),
defaultMeta: { service: 'user-service' },
transports: [
new transport({winstonConfig: { filename: 'error.log', level: 'error' }, amqp: {}}),
],
});
setInterval(() => {
logger.log('Log me');
}, 1000);
1.1.14
2 years ago
1.1.12
3 years ago
1.1.11
3 years ago
1.1.9
4 years ago
1.1.8
4 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.1
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago