za-eye
v1.3.3
Published
nodejs logger.
Downloads
3
Readme
日志接入
初始化及配置
require('za-eye').config({ contextPath, projectName, appName, mode });
日志输出
const zaeye = require('za-eye');
/**
* 基础日志接口
* winston()
* logger(meta) 可设置默认原数据
*
* logger[level](message, mate)
* logger[level](mate)
* logger.log(level, message, mate)
*/
const logger = zaeye.winston(); // 未包装
const logger = zaeye.logger();
logger.info('example');
/**
* 业务日志接口
* bizLogger
*
* bLogger[level](mate)
*/
const bLogger = zaeye.bizLogger();
bLogger.info('example');
/**
* 扩展日志接口
* 业务中主要使用stackLogger和identifierLogger
*
* stackLogger() 自动开启调用信息显示
*
* sLogger[level](message, mate)
* sLogger[level](mate)
*
*
* metaLogger(meta, loadStack) 可设置默认原数据及是否开启调用信息显示
* sLogger[level](message, mate)
* sLogger[level](mate)
*
*
* identifierLogger(meta, loadStack) for identifier
*
* iLogger(identifier, functionName)[level](message, mate)
* iLogger(identifier, functionName)[level](mate)
*/
const sLogger = zaeye.stackLogger();
const iLogger = zaeye.identifierLogger();
sLogger.info('example');
iLogger('/api').info('example');
const iLogger = zaeye.identifierLogger()('identifier');
iLogger.info('example');
原数据保留字段
- identifier
- callee