-
Notifications
You must be signed in to change notification settings - Fork 38
feat(echo): set log level according to env #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(echo): set log level according to env #225
Conversation
I had some issues with testing
because it the path to When fixed, then it should be something like this:
The echo worker should be installed using:
When echo worker is installed to |
Are these changes introduced by this PR? If not, can you submit a PR to update HACKING? |
Sure I will create PR... I just wanted to add some notes about it somewhere. And the comment was the right place for the case somebody else want to test it. |
The PR with updated instructions: #227 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good. I have only two questions/suggestions.
if logLevel, ok := os.LookupEnv("YGG_LOG_LEVEL"); ok { | ||
level, err := log.ParseLevel(logLevel) | ||
if err != nil { | ||
log.Fatalf("cannot parse log level: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When log level could not be parsed, is it good idea to set this wrong log level. Shouldn't we skip skip setting log level in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Fatal
will print the message string and then exit the program, so here we are not setting an invalid level. The program is exiting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't know that. It is then OK.
Set the log level according to the value of YGG_LOG_LEVEL. Print the worker's environment when run at level Debug or higher. Signed-off-by: Link Dupont <link@sub-pop.net>
Add more debug logging to the startWorker and loadWorkerConfig functions. Signed-off-by: Link Dupont <link@sub-pop.net>
74800f1
to
b7ec70c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if logLevel, ok := os.LookupEnv("YGG_LOG_LEVEL"); ok { | ||
level, err := log.ParseLevel(logLevel) | ||
if err != nil { | ||
log.Fatalf("cannot parse log level: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't know that. It is then OK.
Set the log level according to the value of YGG_LOG_LEVEL.
Print the worker's environment when run at level Debug or higher.