Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

main: added structured log option [Fixes #39] #47

Merged
merged 4 commits into from
May 27, 2020

Conversation

liafizan
Copy link
Contributor

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

  • New feature (non-breaking change which adds functionality)

Checklist

  • Unit tests updated: NA
  • [+ ] Documentation updated

@codecov
Copy link

codecov bot commented May 15, 2020

Codecov Report

Merging #47 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b27b2a...26001c4. Read the comment docs.

@Smiley73 Smiley73 requested a review from seanmalloy May 21, 2020 12:12
@Smiley73
Copy link

@faizan82 thanks for the PR. It looks good to me, I just want another set of eyes on it.
Apologies for moving so slow, unfortunately we're short staffed due to the pandemic.

main.go Outdated
flag.Parse()

// Init checks
if len(filename) == 0 {
log.Errorf("No configuration file provided")
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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)
}
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

@liafizan liafizan May 23, 2020

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.

@seanmalloy seanmalloy added this to the v0.1.2 milestone May 27, 2020
Copy link
Contributor

@seanmalloy seanmalloy left a 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!

@seanmalloy seanmalloy merged commit f7da486 into KohlsTechnology:master May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants