Firebase 本機模擬器套件提供了豐富的使用者介面,其中包括對查看模擬器日誌的支援。您可以使用本頁所述的查詢語法在模擬器套件 UI 中篩選日誌。
日誌查詢語言支援精確比較and
操作。目前不支援其他操作。
引號通常是可選的,除非使用空格或換行符。
請注意,此查詢語法僅在模擬器套件 UI 中可用。模擬器在專案目錄中的*-debug.log
檔案中輸出其他日誌(例如firestore-debug.log
)。
// Find only info logs. level=info //Find logs for the sayHelloWorld function metadata.emulator.name=functions metadata.function.name=sayHelloWorld //Find any log mentioning "hello world" hello world // turns into search="hello world" internally //Return any Hosting POST requests metadata.emulator.name=hosting search=POST
關鍵字
等級
日誌等級。 warn, info, error
之一。
搜尋
模糊搜尋中要匹配的文字。例如, search=abc
傳回帶有文字「abc」的日誌。
使用search
關鍵字可以使用and
運算子將模糊搜尋與其他關鍵字搜尋結合。
元數據
查詢特定模擬器或函數名稱。
元資料.模擬器.名稱
查詢指定模擬器的日誌。 firestore, functions, database, pubsub, hosting, storage
之一。
元資料.函數.名稱
在使用者應用程式程式碼中定義的函數名稱。
使用者
使用者從應用程式內程式碼記錄的任何 JSON 數據,例如:
console.log(JSON.stringify({hello: world}))
上述日誌輸出可以透過user.hello
查詢。