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
查询。