-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use development logging when running a local build #889
Conversation
The [zap development logger](https://godoc.org/go.uber.org/zap#NewDevelopmentConfig) provides nicer console output as well as a few other different defaults for development. To decide whether to use production or development it's checking if `Version` has been set at build time. If not it assumes it's development. It may be better not to conflate version number with build type in which case we could add a separate build type. But first I wanted to see if the general idea desirable.
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.
Nice, I really like the idea. As you said it will be better to have it separated from version, so another variable to control for that and it LGTM.
+1 can we make it a CLI flag so same build can do both? |
Err sorry, still have to add the separate control var so ignore the review request temporarily. :) |
Codecov Report
@@ Coverage Diff @@
## master #889 +/- ##
==========================================
- Coverage 85.99% 85.94% -0.05%
==========================================
Files 166 166
Lines 12980 12993 +13
==========================================
+ Hits 11162 11167 +5
- Misses 1396 1403 +7
- Partials 422 423 +1
Continue to review full report at Codecov.
|
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.
) | ||
|
||
const ( | ||
logLevelCfg = "log-level" | ||
logLevelCfg = "log-level" | ||
logProfileCfg = "log-profile" |
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.
I wonder if we want to make this more generic, ie.: use profile
for other things but this is already a good start. Let's keep as it is at least for now.
* Use development logging when running a local build The [zap development logger](https://godoc.org/go.uber.org/zap#NewDevelopmentConfig) provides nicer console output as well as a few other different defaults for development. To decide whether to use production or development it's checking if `Version` has been set at build time. If not it assumes it's development. It may be better not to conflate version number with build type in which case we could add a separate build type. But first I wanted to see if the general idea desirable. * add log profile flag * add build variable
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
The zap development logger provides nicer console output as well as a few other different defaults for development.
To decide whether to use production or development it's checking if
Version
has been set at build time. If not it assumes it's development. It may be
better not to conflate version number with build type in which case we could
add a separate build type. But first I wanted to see if the general idea
desirable.
Before
After