SYS_Log.add() method
Add a log entry
Signature
typescript
function add(message: string, type?: ESYS_LogType): void;1
Parameters
Parameter | Type | Description |
|---|---|---|
message | string | Log content |
type | (Optional) Log type |
Returns
void
Example
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