Plugin API
繁體中文
繁體中文
  • 入門
    • 簡介
    • 你的第一個插件
    • 檔案結構概述
    • 插件類型
      • 視窗
      • 背景服務
      • 格式擴充
      • 檢查器
    • 除錯插件
  • 部署
    • 準備插件
    • 打包插件
    • 發佈插件
    • 更新插件
    • 開發者政策
    • 插件圖示樣板
  • 開發指南
    • manifest.json 完整設定
    • 取得數據
    • 修改數據
    • 存取本機檔案
    • 發出網路請求
    • 使用 Node.js 原生 API
    • 使用第三方模快
    • 多國語言(i18n)
    • 無邊框視窗
  • API 參考
    • event(事件)
    • item(項目)
    • folder(資料夾)
    • tag(標籤)
    • tagGroup(標籤群組)
    • library(資源庫)
    • window(視窗)
    • app(應用)
    • os(作業系統)
    • screen(螢幕)
    • notification(通知)
    • contextMenu(右鍵選單)
    • dialog(對話框)
    • clipboard(剪貼板)
    • drag(拖曳檔案)
    • shell(殼)
    • log(日誌)
  • 额外组件
    • FFmpeg
Powered by GitBook
On this page
  • debug(obj)
  • info(obj)
  • warn(obj)
  • error(obj)
  1. API 參考

log(日誌)

在 Eagle 軟體日誌記錄特定資訊,以利開發中的除錯、除錯。

Previousshell(殼)NextFFmpeg

Last updated 2 years ago

點擊這裏查看 Eagle 獲取方式。

eagle.log.debug('debug message from plugin');
eagle.log.info('info message from plugin');
eagle.log.warn('warn message from plugin');
eagle.log.error('error message from plugin');

// [13:19:39.845] [debug] [plugin] "debug message from plugin"
// [13:19:39.845] [info] [plugin] "info message from plugin"
// [13:19:39.845] [warn] [plugin] "warn message from plugin"
// [13:19:39.845] [error] [plugin] "error message from plugin"

方法

debug(obj)

記錄 debug 類型內容到軟體日誌

  • obj Object - 欲記錄之內容,可以是 Object、String、Array 等各種格式

eagle.log.debug(obj);
eagle.log.debug(array);
eagle.log.debug('error message from plugin');

info(obj)

記錄 info 類型內容到軟體日誌

  • obj Object - 欲記錄之內容,可以是 Object、String、Array 等各種格式


warn(obj)

記錄 warn 類型內容到軟體日誌

  • obj Object - 欲記錄之內容,可以是 Object、String、Array 等各種格式


error(obj)

記錄 error 類型內容到軟體日誌

  • obj Object - 欲記錄之內容,可以是 Object、String、Array 等各種格式

try {
    let a = {};
    a.b.c = 'test';
}
catch (err) {
    eagle.log.error('error message from plugin');
    eagle.log.error(err.stack || err);
}

// [13:23:24.191] [error] [plugin] "error message from plugin"
// [13:23:24.191] [error] [plugin] "TypeError: Cannot set properties of undefined (setting 'c')\n    at <anonymous>:3:11"

軟體日誌