Greasy Fork is available in English.

CKLogger

A inheritable and subscribable logger util.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/441386/1027348/CKLogger.js

Aŭtoro
CKylinMC
Versio
1.0
Kreita
2022/03/12
Ĝisdatigita
2022/03/12
Licenco
GPLv3 License

可订阅的多级控制台消息输出工具。

  • 自定义控制台消息提供者, logger.serviceProvider=console
  • 支持log/info/warn/error/debug,支持自定义输出方法
  • 可父子级输出日志, const childLogger = parentLogger.getSubLogger('childname')
  • 可禁用, logger.setVisible(false)
  • 可订阅, logger.subscribe({levels:['error','warn'],onlyVisible:true,includeSubLoggers:true,onlog:(level,namespace,...args)=>{/*do sth here*/}})