SYS_Log.add() method
添加日志条目
签名
typescript
function add(message: string, type?: ESYS_LogType): void;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
message | string | 日志内容 |
type | (可选) 日志类型 |
返回值
void
示例
javascript
// 1. 写入三条不同类型的日志(同步调用,立即生效)
eda.sys_Log.add('嘉立创示例_插件启动,开始处理任务');
eda.sys_Log.add('嘉立创示例_检测到网络波动,将自动重试', 'warn');
eda.sys_Log.add('嘉立创示例_文件解析失败', 'error');
// 2. 查询日志面板,确认条目已写入(find 返回 Promise,需要 await)
const found = await eda.sys_Log.find('嘉立创示例_');
console.log('写入的日志条目数:', found.length);
console.log('其中一条:', found[0].message, '(类型:', `${found[0].type})`);1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9