mocoolka-log
Mocoolka-log is base module for mocoolka application and write message to file or database or mail.
Last updated 3 years ago by mocoolka .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mocoolka-log 
SYNC missed versions from official npm registry.

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).

Current Tags

  • 0.5.1                                ...           latest (3 years ago)

2 Versions

  • 0.5.1                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |