siwi-logger
v1.0.9
Published
siwi-logger
Downloads
31
Maintainers
Readme
siwi-logger
siwi-microservice 微服务 记录日志 按日期分片
- 简单的日志记录 文件流
Install
use yarn
yarn add siwi-logger
use npm
npm install siwi-logger
初始化 init
- 配置
{
logger: {
path: `${process.env.PWD}/logs`,
expire: 86400*7,
name: 'siwi-logger'
}
}
写日志 log
const Logger = require('../index')
class Example {
constructor () {
this.test()
}
/**
* 测试日志
*
* @memberof Test
*/
async test () {
// 自定义日志目录
const config = {
path: `${process.env.PWD}/test/logs`,
expire: 86400*7,
name: 'siwi-logger'
}
await Logger.init(config)
await Logger.log('很好的是Good')
}
}
module.exports = new Example()