1.0.2 • Published 5 years ago

loghere v1.0.2

Weekly downloads
3,394
License
MIT
Repository
github
Last release
5 years ago

loghere

可以在 PM2 和 Serverless 中使用的一款简易日志工具

简介

在 Node.js 中,比较成熟的日志工具是 log4js,但是由于种种原因,在和 pm2 搭配使用时,log4js 打印的日志很难被 pm2 接收,需要进行很多的额外配置。loghere 就是为了解决这个问题诞生的。与 log4js 的功能完整相比,loghere 只提供了非常轻量级的功能,同时保持了和 log4js 类似的 API,使用上非常简单。

安装

直接使用 npm 命令安装即可:

npm i loghere

使用

const loghere = require('loghere')    // 引用
const logger = loghere.getLogger()    // 获取日志实例
logger.level = 'debug'				  // 设置日志等级
logger.debug('这是日志内容')            // 打日志

日志等级

包含以下日志等级: 1. ALL (默认) 2. TRACE 3. DEBUG 4. INFO 5. WARN 6. ERROR 7. FATAL 8. MARK 9. OFF

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago