Skip to content
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

Add NoUppercaseLevel option #6

Merged
merged 1 commit into from
Sep 19, 2020
Merged

Conversation

dfateyev
Copy link
Contributor

A small but usable log level formatting option, for those who don't want to see it upper case.
Being set to "true", it doesn't transform the original level value.

Sep 11 01:37:19.892 [info] this is nested-logrus-formatter demo
Sep 11 01:37:19.893 [info] [web-server] starting...
Sep 11 01:37:19.893 [info] [web-server] [GET /api/stats] [#1] params: startYear=2048
Sep 11 01:37:19.893 [erro] [web-server] [GET /api/stats] [#1] response: 400 Bad Request
Sep 11 01:37:19.893 [info] [db-connector] connecting to db on 10.10.10.13...
Sep 11 01:37:19.893 [warn] [db-connector] connection took 10s
Sep 11 01:37:19.893 [info] demo end.

@coveralls
Copy link

coveralls commented Sep 10, 2020

Pull Request Test Coverage Report for Build 44

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 40: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 42

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 40: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

formatter.go Outdated
@@ -34,6 +34,9 @@ type Formatter struct {
// ShowFullLevel - show a full level [WARNING] instead of [WARN]
ShowFullLevel bool

// NoUpcaseLevel - no upper case for level value
NoUpcaseLevel bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dfateyev! Thanks for the PR, I like it! Let's make it NoUppercaseLevel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it NoUppercaseLevel?

Well, the only concern is it would be bulky being compared to other options (16 chars against the longest 14 chars NoFieldsColors parameter). But if you think it's better — I can adjust the name.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's longer, but it feels grammatically correct 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have merged all changes into one commit, and renamed PR according the new option's name. Please review the current changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

	NoColors bool

	// NoFieldsColors - apply colors only to the level, default is level + fields
	NoFieldsColors bool

	// NoFieldsSpace - no space between fields
	NoFieldsSpace bool

	// ShowFullLevel - show a full level [WARNING] instead of [WARN]
	ShowFullLevel bool

	// NoUppercaseLevel - no upper case for level value
	NoUppercaseLevel bool

	// TrimMessages - trim whitespaces on messages
	TrimMessages bool

Btw, "NoUppercaseLevel" is placed after "ShowFullLevel" in Readme. In case if it matters — I can move it after "NoFieldsSpace" (to me, there is no much difference though).

@dfateyev dfateyev changed the title Add NoUpcaseLevel option Add NoUppercaseLevel option Sep 14, 2020
@antonfisher antonfisher merged commit d41190e into antonfisher:master Sep 19, 2020
@antonfisher
Copy link
Owner

@dfateyev thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants