-
Notifications
You must be signed in to change notification settings - Fork 115
Refactor how the logs work #89
Conversation
Codecov Report
@@ Coverage Diff @@
## master #89 +/- ##
===========================================
- Coverage 76.49% 64.13% -12.36%
===========================================
Files 52 52
Lines 2097 2130 +33
===========================================
- Hits 1604 1366 -238
- Misses 493 764 +271
Continue to review full report at Codecov.
|
Hey Jason, most of this sounds good! I'd have to ensure that if we're no longer overriding As well, I noticed that emulator code has a lot of I also want to confirm that it is your intention to not display the error messages in the terminal when tail is set to false. |
All The Emulator debugging logs ( |
Sounds good. I agree with your rationale that the emulator should provide the same logs as production. I am also seeing cases such as https://github.com/GoogleCloudPlatform/cloud-functions-emulator/blob/master/src/cli/controller.js#L173, where the messages do not show up in production. Having them be written to stdout is cluttering up the terminal. Perhaps these should be changed to logger.debug instead? Should error logs be sent to the terminal if tail is set to false? |
Actually, some of the logs should conditionally change their log level based on the value of the
No, because if |
I've added more commits:
Let me know what you think so far. As for your comment about conditionally changing log levels, what do you think about making use of more granular levels for logging? Winston supports all 6 of the npm logging levels. My suggestion would be:
The Firebase CLI would use info level logs, and this CLI would can default to verbose level logs. This would also mean adding one more config option (debug), so log level would be verbose if verbose=true, and debug if debug=true. |
This is what I'm thinking:
tail
option to thestart
command.tail
istrue
:start
command should notunref()
the child, but should wait for the child to die.Console
andFile
.tail
isfalse
:start
command willunref()
the child and exit.File
.console
methods withwinston
methods, move logging into its own module that can be imported where its needed and components can calllogger.log()
instead ofconsole.log()
, etc.