siwi-logger

1.0.9 • Public • Published

npm

npm

Packagist

platform

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

Package Sidebar

Install

npm i siwi-logger

Weekly Downloads

0

Version

1.0.9

License

MIT

Unpacked Size

13.1 kB

Total Files

10

Last publish

Collaborators

  • siwi