3h-log 中文文档教程
3h-log
记录器库。
Features
- Log with formatted time stamps (using
3h-time
) - Log with various prefixes
- Log level control
Example
const Logger = require('3h-log'),
logger = new Logger({ timeFormat: '[YYYY-MM-DD HH:mm:SS.sss]' });
logger.print('custom', 'Custom messages.');
logger.setLevel('log');
logger.error('Some errors.');
logger.warn('Some warnings.');
logger.info('Some infomation.');
logger.log('Some logs.');
logger.debug('This should not be seen!');
APIs
只需阅读 typings
中的类型声明文件即可了解 API。
3h-log
A logger lib.
Features
- Log with formatted time stamps (using
3h-time
) - Log with various prefixes
- Log level control
Example
const Logger = require('3h-log'),
logger = new Logger({ timeFormat: '[YYYY-MM-DD HH:mm:SS.sss]' });
logger.print('custom', 'Custom messages.');
logger.setLevel('log');
logger.error('Some errors.');
logger.warn('Some warnings.');
logger.info('Some infomation.');
logger.log('Some logs.');
logger.debug('This should not be seen!');
APIs
Just read the type declaration files in typings
to learn the APIs.