-
Notifications
You must be signed in to change notification settings - Fork 49
main: added structured log option [Fixes #39] #47
Conversation
Codecov Report
@@ Coverage Diff @@
## master #47 +/- ##
=======================================
Coverage 42.59% 42.59%
=======================================
Files 21 21
Lines 979 979
=======================================
Hits 417 417
Misses 486 486
Partials 76 76 Continue to review full report at Codecov.
|
@faizan82 thanks for the PR. It looks good to me, I just want another set of eyes on it. |
main.go
Outdated
flag.Parse() | ||
|
||
// Init checks | ||
if len(filename) == 0 { | ||
log.Errorf("No configuration file provided") |
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 think this should use log.Error
instead of log.Errorf
.
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.
thank you @seanmalloy fixed this
main.go
Outdated
} | ||
|
||
//log.Infof("Starting git2consul version: %s", version.Version) |
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.
Please remove this line of commented code.
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.
thank you @seanmalloy removed the line
log.Error("No configuration file provided") | ||
flag.Usage() | ||
os.Exit(ExitCodeFlagError) | ||
} |
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.
Moving this check above the the "if printVersion" check on lines 71 to 74 causes the below bug.
/git2consul -version
2020/05/21 21:48:15 error No configuration file provided
Usage of ./git2consul:
-config string
path to config file
-debug
enable debugging mode
-logfmt string
specify log format [text | json] (default "text")
-once
run git2consul once and exit
-version
show version
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.
oops. Let me fix this and may be write a few test cases to cover these cases as well for future changes
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.
@seanmalloy thank you for spending time on this PR. I have fixed this issue and added two checks in e2e pkg.
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 - @faizan82 thanks for your contribution!
Description
Added option for structured log
Usage is displayed in case config file is not provided as an option
Fixes #ISSUE-39
Type of change
Checklist