Narcissistic, Perfectly Modest

    log4js-aliyun

    1.0.3 • Public • Published

    log4js-aliyun

    修改至log4js-aliyun-log,适配log4js 2.0以上

    安装

    npm install log4js-aliyun --save
    

    配置

     
    {
          "type": "log4js-aliyun",
          "layout": {
            "type": "pattern",
            "pattern": "%p %c %m"
          },
          "aliyunKey":"aliyunKey",
          "aliyunSecret":"aliyunSecrect",
          "endpoint":"http://cn-hangzhou.sls.aliyuncs.com",
          "slsProject":"porjectname",
          "logStoreName":"logStoreName",
          "topic":"",
          "category": "test"
    }
     

    更多配置请参考aliyun sdk's js.

    示例

    var log4js=require('log4js');
    var cfg={
        appenders:{
          "type": "log4js-aliyun",
          "layout": {
            "type": "pattern",
            "pattern": "%p %c %m"
          },
          "aliyunKey":"aliyunKey",
          "aliyunSecret":"aliyunSecrect",
          "endpoint":"http://cn-hangzhou.sls.aliyuncs.com",
          "slsProject":"porjectname",
          "logStoreName":"logStoreName",
          "topic":"",
          "category": "test"
        }
    }
    log4js.configure({
        appenders: { console: { type: 'console' }, sls: cfg.appenders },
        categories: { default: { appenders: ['console', 'sls'], level: "TRACE" }}
    });

    Install

    npm i log4js-aliyun

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • zsea