mocoolka-log
v0.5.1
Published
Mocoolka-log is base module for mocoolka application and write message to file or database or mail.
Downloads
4
Readme
mocoolka-log
Mocoolka-log is base module for mocoolka application and write message to file or database or mail.
Install
$ npm install mocoolka-log
Usage
first install mocoolka-setting and mocoolka-i18n
$ npm install mocoolka-setting
$ npm install mocoolka-i18n
edit log config in app.mk-setting.json
"mocoolka-log": {
"log4js": {
"appenders": {
"mail": {
"type": "smtp",
"recipients": "[email protected]",
"from": "[email protected]",
"sendInterval": 5,
"transport": "SMTP",
"SMTP": {
"host": "smtp.mocoolka.com",
"secureConnection": true,
"port": 25,
"auth": {
"user": "[email protected]",
"pass": "*****"
},
"debug": true
}
}
},
"categories": {
"default": {
"appenders": [
"mocoolka",
"mail"
],
"level": "debug"
}
}
}
}
start micro service
const settingService = require('mocoolka-setting');
settingService(__dirname);
const i18nService = require('mocoolka-i18n');
i18nService(__dirname);
const logService = require('mocoolka-log');
logService();
log using level
const {serviceTools } = require('mocoolka-tools');
serviceTools.standClientPromise('mocoolka-log','rfc5424',
{level:'info',message:{id:'test123'}}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','emergency',
{id:'emergency-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','alert',
{id:'alert-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','critical',
{id:'critical-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','error',
{id:'error-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','warning',
{id:'warning-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','notice',
{id:'notice-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','info',
{id:'info-client'}).catch(error=>{
console.error(error);
});
serviceTools.standClientPromise('mocoolka-log','debug',
{id:'debug-client'}).catch(error=>{
console.error(error);
});
Documentation
Available here
License
Licensed under the MIT, version 2.0. (see MIT).