
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
klg-logger
Advanced tools
log 工具,基于 tracer,简单,可以显示 log 的位置
见 tracer 文档 https://www.npmjs.com/package/tracer
默认版本是把 log 输出到 console
import { Logger } from 'klg-logger'
const logger = new Logger({
level: config.get('log.level'),
dateformat: 'yyyy-mm-dd HH:MM:ss.L',
inspectOpt: {
showHidden: false, // if true then the object's non-enumerable properties will be shown too. Defaults to false
depth: 5 // tells inspect how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. Defaults to 2. To make it recurse indefinitely pass null.
}
})
logger.info('hello world')
logger.debug('hello %s', 'world')
logger.error('hello %s', 'error')
export default logger
如果你需要把 log 输出到文件或者发送其他地方,可以自定义 transport function
const logger = new Logger({
level: 'log',
transport: function (data: Tracer.LogOutput) {
// 写文件
fs.write(data)
// 发送其他地址
tcp.send(data)
assert(data)
assert(data.level === 0)
}
})
logger.log('hello world')
FAQs
log 工具,基于 tracer,简单,可以显示 log 的位置
The npm package klg-logger receives a total of 27 weekly downloads. As such, klg-logger popularity was classified as not popular.
We found that klg-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.