1.0.51 • Published 2 years ago
zrplatform-lc-log v1.0.51
丽呈日志插件
- AccessLog: 当前路由日志
- ActionLog: 动作日志,通过client发起的网络请求日志
- DataBaseLog: 数据库日志
- BusinessLog: 业务日志
- ThirdPartyLog: 第三方调用
使用方法
- 安装
npm install zrplatform-lc-log --save - 在项目启动文件中作为zrplatform的log配置参数传入
const platform = require('zrplatform')
const httpTransport = require('zrplatform-http-transport')
const zrPlatformLcLog = require('zrplatform-lc-log')
platform
.transport('http', httpTransport)
.start()
.logger(zrPlatformLcLog)配置项说明
| 环境变量 | 说明 |
|---|---|
| ACCESSHOST | AccessLog 对应的kafka地址 |
| ACCESSTOPIC | AccessLog 对应的Topic |
| ACTIONHOST | ActionLog 对应的kafka地址 |
| ACTIONTOPIC | ActionLog 对应的Topic |
| BUSINESSHOST | BusinessLog 对应的kafka地址 |
| BUSINESSTOPIC | BusinessLog 对应的Topic |
| DATABASEHOST | DataBaseLog 对应的kafka地址 |
| DATABASETOPIC | DataBaseLog 对应的Topic |
| THIRDPARTYHOST | ThirdpartyLog 对应的kafka地址 |
| THIRDPARTYTOPIC | ThirdpartyLog 对应的Topic |
AccessLog
该日志参数由zrplatform框架拦截express的req和res创建
ActionLog
该日志参数由zrplatform框架拦截express和request的req和res创建
DataBaseLog
| 参数名 | 说明 | 默认值 |
|---|---|---|
| position | 位置 | |
| scene | 场景 | |
| logContent | 备注信息 | |
| user | 用户 | |
| error.message | 错误信息 | |
| error.stack | 堆栈 |
BusinessLog
| 参数名 | 说明 | 默认值 |
|---|---|---|
| position | 位置 | |
| scene | 场景 | |
| logContent | 备注信息 | |
| user | 用户 | |
| error.message | 错误信息 | |
| error.stack | 堆栈 |
ThirdPartyLog
| 参数名 | 说明 | 默认值 |
|---|---|---|
| logType | 是否异常,异常=1,正常=0 | |
| methodName | 方法名称 | |
| exceptionMessage | 异常信息 | |
| detail | 详细异常信息 | |
| parameters | 方法的入参 json格式 | |
| result | 方法的返回值 json格式 | |
| urlAliases | url别名 | |
| realUrl | 真实请求的url | |
| timeout | 超时时间 | |
| retryCount | 重试次数 |
1.0.51
2 years ago