Skip to content

Allow --quiet flag for emulators:start #2859

Closed

Description

@kentcdodds

[REQUIRED] Environment info

firebase-tools: 8.16.2 (latest)

Platform: macOS

[REQUIRED] Test case

Literally anywhere, but sure you can use this: https://github.com/kentcdodds/elaborate

[REQUIRED] Steps to reproduce

  1. Run firebase emulators:start
  2. Notice there's a ton of output, much of it is not useful
  3. Dig through the firebase-tools code and find this handy option
  4. Try to enable it with firebase emulators:start --quiet
  5. Notice the error: unknown option '--quiet' output
  6. Try adding the option here
  7. Run firebase emulators:start --quiet again
  8. Notice that you no longer get the error, but this.args.quiet is still undefined in functionsEmulator.js so that doesn't work either.
  9. Discover emulators-startts and try a few things but ultimately give up.

[REQUIRED] Expected behavior

I want to be able to silence most of the output when I start my firebase function.

[REQUIRED] Actual behavior

Instead, I get a bunch of output that hides output from my functions:

Screen Shot 2020-11-23 at 4 41 06 PM

Can you find my own logs? After a bit of time looking for them, so can I:

>  getting post with ID xbxfZqu5gXN5QyhcfmGk

I'd much rather not have to search through all that output, which is why I'd like to have this --quiet option. Or perhaps a --loglevel option or something. I just need a way to silence the firebase logs.

Activity

  1. changed the title [-]Allow `--quiet` flag[/-] [+]Allow `--quiet` flag for `emulators:start`[/+] on Nov 23, 2020
  2. samtstern commented on Nov 24, 2020

    @samtstern
    Contributor

    @kentcdodds thanks for the feedback. There has already been quite a lot of discussion about the emulators logging here:
    #1839

    While we do agree that they're a bit noisy, it doesn't seem like we're going to be able to reach consensus about which logs need to be quieted. Every log line has a few fans.

    One way we're trying to address this is through the Emulators UI "Logging" tab which allows you to add custom filters for different types of logs and their content. Have you tried that?

  3. kentcdodds commented on Nov 24, 2020

    @kentcdodds
    Author

    Thanks for the info @samtstern,

    I don't want to use the UI, I like seeing the logs in the terminal (I have other processes I'm running concurrently and like to see their logs as well).

    Could we not start with a way to quiet all logs? Then things could become more granular from there.

  4. samtstern commented on Nov 24, 2020

    @samtstern
    Contributor

    @kentcdodds that's a reasonable request, just want to clarify:

    • Do you want your user logs from within Functions to be excluded?
    • Do you want the initial startup logs (the table with the ports and such)?
    • What about error-level logs?
  5. kentcdodds commented on Nov 24, 2020

    @kentcdodds
    Author
    • Do you want your user logs from within Functions to be excluded?

    No, the pain point I'm feeling right now is that it's difficult for me to find my own logs in the sea of emulator logs. So I want only my logs to be shown when I enable --quiet

    • Do you want the initial startup logs (the table with the ports and such)?

    I'm fine either way. Doesn't conflict with my desire to see my own function logs. I'd personally prefer something less huge during --quiet mode, but it's not a big deal. I just want to see my own logs.

    • What about error-level logs?

    I think if error-level logs were hidden, then folks would be worried about missing important errors and wouldn't use --quiet, so those are probably good to keep included.

  6. exKAZUu commented on Apr 22, 2021

    @exKAZUu
    Contributor

    @samtstern As another use case, we'd like to make firebase emulators:exec silent (by default).

    When we use the package.json including the following content, the exit code of yarn test always returns 0 because grep returns 0 (c.f. #1839 (comment)). So this mean we cannot detect a test failure.

      "scripts": {
        "test": "firebase emulators:exec --project XXX \"exit -1\" | grep -v \"hosting:\""
      },
    

    on Mac OS with the following environment:

    $ node --version
    v14.16.1
    $ yarn --version
    1.22.10
    $ yarn firebase --version
    9.9.0
    
  7. exKAZUu commented on Apr 22, 2021

    @exKAZUu
    Contributor

    hm, I solved the issue by appending set -o pipefail to the head of the command.

    e.g.

      "scripts": {
        "test": "set -o pipefail && firebase emulators:exec --project XXX \"exit -1\" | grep -v \"hosting:\""
      },
    
  8. unicornware commented on Apr 22, 2021

    @unicornware

    Introducing the --quiet flag for firebase emulators:exec commands would dramatically improve user experience when using Jest alongside the Firebase Emulator.

    The logs make test output difficult to locate, especially when looking for Jest's Summary of Failing Tests - so much so that I don't want to use the Emulator until this is solved or I can find a workaround.

    Example:

    Screen Shot 2021-04-22 at 2 39 39 PM

    Screen Shot 2021-04-22 at 2 39 59 PM

  9. spicemix commented on Apr 28, 2021

    @spicemix

    ...and becomes quite a problem when load testing with artillery.

    (Why load test on an emulator? To see how things work with the scenario before having to pay for it!)

    I would like it for :exec as well as :start for CI use thanks!

  10. JasperSurmont commented on May 26, 2021

    @JasperSurmont

    Is there any progress in allowing us to use a --quiet flag to disable all emulator logs?

  11. nitaigao commented on Jun 29, 2021

    @nitaigao

    Ideally would prefer to see zero log output from the emulators when running unit tests

  12. yuchenshi commented on Jul 27, 2021

    @yuchenshi
    Member

    Hi, thanks for filing this feature request! We are unable to promise any timeline for this, but if others also have this request, adding a +1 on this issue can help us prioritize adding this to the roadmap.

    (Googler-only internal tracking bug: b/194801987)

  13. 15 remaining items

  14. isomorpheric commented on Oct 3, 2023

    @isomorpheric

    image

    I wish we could suppress these logs in the firebase configuration file - or at least via a command flag during starting the emulators. It clutters our CI logs in a non-meaningful way.

  15. christhompsongoogle commented on Oct 3, 2023

    @christhompsongoogle
    Contributor

    Setting verbosity via flag: #6429

  16. deleted a comment from gustavopch on Oct 9, 2023
  17. lox commented on Nov 7, 2023

    @lox

    Has anyone actually been able to get this to work? I'm running 12.8.1 with the following:

    firebase emulators:exec --project patientnot --log-verbosity SILENT 'npm run test:system'
    

    I still get all the log spam:

      services/organization
        create
    i  functions: Loaded environment variables from .env.dev.
    i  functions: Beginning execution of "australia-southeast1-auth-onUserCreate"
    >  info: Created userMeta for testOwner {}
    i  functions: Finished "australia-southeast1-auth-onUserCreate" in 58.244959ms
          ✔ should create a new organization with valid inputs (1275ms)
    i  functions: Beginning execution of "australia-southeast1-auth-onUserCreate"
    >  info: Created userMeta for testOwner {}
    i  functions: Finished "australia-southeast1-auth-onUserCreate" in 5.904875ms
          ✔ should throw a ValidationError when the user is already part of an organization (39ms)
    i  functions: Beginning execution of "australia-southeast1-auth-onUserCreate"
    >  info: Created userMeta for testOwner {}
    i  functions: Finished "australia-southeast1-auth-onUserCreate" in 4.433375ms
          ✔ should throw a ValidationError when the user has not verified their email address
    i  functions: Beginning execution of "australia-southeast1-auth-onUserCreate"
    >  info: Created userMeta for testOwner {}
    i  functions: Finished "australia-southeast1-auth-onUserCreate" in 5.289625ms
    
  18. isomorpheric commented on Nov 8, 2023

    @isomorpheric

    Similar to @lox - I also still get logs, on version 12.8.1:

    image

    My command:

    image

  19. self-assigned this
    on Nov 14, 2023
  20. joehan commented on Nov 14, 2023

    @joehan
    Member

    Looks like we may have missed a spot for piping through the new --log-vebosity flag to the functions emualtor. Going to take a look today and try to get a fix out in the next patch release.

  21. added a commit that references this issue on Dec 14, 2023
  22. added a commit that references this issue on Apr 26, 2024
  23. steveobd commented on Jun 17, 2024

    @steveobd

    +1

  24. risalfajar commented on May 29, 2025

    @risalfajar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions