We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当定义了一个日志级别时: 例如: log4js.levels.addLevels({ KEY: { value: 30001, colour: 'yellow' } }) 再使用新的级别记录日志: logger._log('KEY', ‘测试关键日志’); 会报错: categoryAppenders.forEach(appender => { ^ TypeError: eventLevel.isGreaterThanOrEqualTo is not a function
导致这个原因是在log4js.d.ts这样定义_log方法的: _log(level: string, data: any): void;
应该改成: _log(level: Level, data: any): void; 然后使用以下方法记录相应的日志 logger._log(log4js.levels.getLevel('KEY'), "测试关键日志’")
The text was updated successfully, but these errors were encountered:
Fixed in log4js@6.4.0.
log4js@6.4.0
Sorry, something went wrong.
In any case, you should be using log and not _log. It does additional checks for isLevelEnabled before proceeding further to _log (non-public).
log
_log
isLevelEnabled
log4js-node/types/log4js.d.ts
Line 346 in 2d52eb4
log4js-node/lib/logger.js
Lines 71 to 80 in 2d52eb4
Successfully merging a pull request may close this issue.
当定义了一个日志级别时:
例如:
log4js.levels.addLevels({
KEY: {
value: 30001,
colour: 'yellow'
}
})
再使用新的级别记录日志:
logger._log('KEY', ‘测试关键日志’);
会报错:
categoryAppenders.forEach(appender => {
^
TypeError: eventLevel.isGreaterThanOrEqualTo is not a function
导致这个原因是在log4js.d.ts这样定义_log方法的:
_log(level: string, data: any): void;
应该改成:
_log(level: Level, data: any): void;
然后使用以下方法记录相应的日志
logger._log(log4js.levels.getLevel('KEY'), "测试关键日志’")
The text was updated successfully, but these errors were encountered: