@adenin/cf-logger 中文文档教程
Cloud Function Filtered Logger
用于 console
的轻量级包装器,添加了时间戳、日志级别指示器和样式 - 用于腺素云函数。
Installation
使用 npm:
npm install @adenin/cf-logger
Usage
希望使用记录器的文件只需要导入它,然后使用它的方法,如下所示:
const logger = require('@adenin/cf-logger');
const msg = 'Hello world!';
logger.log(msg);
logger.info(msg);
logger.warn(msg);
logger.debug(msg);
logger.error(msg);
如果 NODE_ENV=development
,所有语句都将被记录,如果 NODE_ENV=production
,只会记录错误语句。
Cloud Function Filtered Logger
A lightweight wrapper for console
with added timestamp, log level indicator, and styling - for use with adenin cloud functions.
Installation
Use npm:
npm install @adenin/cf-logger
Usage
A file which wishes to use the logger simply needs to import it, then use its methods, as follows:
const logger = require('@adenin/cf-logger');
const msg = 'Hello world!';
logger.log(msg);
logger.info(msg);
logger.warn(msg);
logger.debug(msg);
logger.error(msg);
If NODE_ENV=development
, all statements will be logged, if NODE_ENV=production
, only error statements will be logged.