mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 10:25:51 +00:00
初步实现Logger功能
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Logger } from './core/logger.js';
|
||||
import { FilePipe } from './core/file-pipe.js';
|
||||
import Logger from './log/Logger.js';
|
||||
import FilePipe from './file/FilePipe.js';
|
||||
|
||||
class Amily2Bus {
|
||||
constructor() {
|
||||
@@ -14,6 +14,20 @@ class Amily2Bus {
|
||||
console.log('[Amily2Bus] Core container initialized with secure registry.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接记录系统级日志 (Global Scope)
|
||||
* 支持手动指定来源,方便终端调试或非插件环境调用
|
||||
* @param {string} type 日志级别 (debug, info, warn, error)
|
||||
* @param {string} message 消息内容
|
||||
* @param {string} [origin='Bus'] 来源模块,默认为 'Bus'
|
||||
* @param {string} [plugin='Global'] 来源插件/命名空间,调试时可指定如 'Console'
|
||||
*/
|
||||
log(type, message, origin = 'Bus', plugin = 'Global') {
|
||||
if (this.Logger) {
|
||||
this.Logger.process(plugin, origin, type, message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册插件并获取专属上下文
|
||||
* @param {string} pluginName 插件名称
|
||||
|
||||
Reference in New Issue
Block a user