mocoolka-log

0.5.1 • Public • Published

mocoolka-log

npm package license Build Status codecov

Mocoolka-log is base module for mocoolka application and write message to file or database or mail.

NPM

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""fastspeeed@mocoolka.com",
          "from""admin@mocoolka.com",
          "sendInterval": 5,
          "transport""SMTP",
          "SMTP"{
            "host""smtp.mocoolka.com",
            "secureConnection"true,
            "port": 25,
            "auth"{
              "user""admin@mocoolka.com",
              "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).

Readme

Keywords

Package Sidebar

Install

npm i mocoolka-log

Weekly Downloads

0

Version

0.5.1

License

MIT

Last publish

Collaborators

  • mocoolka