Skip to content

v1.2.7

Choose a tag to compare

@wangmingjob wangmingjob released this 18 Jun 03:33
· 24 commits to master since this release

添加多日志源功能,

ripple.Default().GetLog("alias")

logger.WithTo(ripple.Default().GetLog("box"), nil).Info("helloworld")
ripple.Default().GetLog("box").WithFields(nil).Info("helloworld2")

config file:

logs: [
  {
    "alias": "box",
    "type": "sls",
    "accessKeyId": "xxxxxxx",
    "accessKeySecret": "xxxxxxx",
    "endpoint": "xxxxxxx",
    "allowLogLevel": "info",
    "closeStdout": false,
    "project": "boxlite",
    "logstore": "xxxxxxx",
    "topic": "*package",
    "source": "source"
  },
  {
    "alias": "user",
    "type": "cls",
    "accessKeyId": "xxxxxxx",
    "accessKeySecret": "xxxxxxx",
    "endpoint": "xxxxxxx",
    "allowLogLevel": "info",
    "closeStdout": false,
    "project": "xxxxxxx",
    "logstore": "xxxxxxx",
    "topic": "topic",
    "source": "source"
  }
]

usage:

logger.WithTo(ripple.Default().GetLog("box"), nil).Info("helloworld")
  or
ripple.Default().GetLog("box").WithFields(nil).Info("helloworld2")