The Firebase Local Emulator Suite provides a rich user interface that includes support for viewing emulator logs. You can filter logs in the Emulator Suite UI using the query syntax described on this page.
Note the following about this language and its syntax:
Supported operations:
- Exact comparisons (
key=value) - Fuzzy text searches (
search=valueor unkeyed text) - Logical
ANDcombinations using multiplekey=valueexpressions separated by spaces or newlines (for example,search=github search=com). Theandkeyword isn't supported.
- Exact comparisons (
Any query without an explicit key is treated as a single
searchterm, including any spaces.Quotes are only supported on values in explicit
key=valueexpressions (for example,search="github"). They are optional except when the value contains spaces or newlines (for example,search="hello world").
Here are some examples of using the log query language for the Emulator Suite UI:
// Find info logs only.
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
Keywords
level
The log level.
One of warn, info, error.
search
The text to match in a fuzzy search.
For example, search=abc returns logs with the text "abc".
Use the search keyword to combine multiple fuzzy searches (for example,
search=github search=com) or to combine fuzzy searches with other keyword
searches (for example, metadata.emulator.name=hosting search=POST).
metadata
Metadata about the log entry, such as the emulator or function name.
metadata.emulator.name
The emulator that generated the log.
One of firestore, functions, database, pubsub, hosting, storage.
metadata.function.name
The function name as defined in your app code.
user
Any JSON data logged from your app code can be queried under user.
For example:
console.log(JSON.stringify({hello: "world"}))
The log output can be queried with user.hello="world" (or user.hello=world).