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

feat(log): extend logger options #15956

Merged
merged 1 commit into from
Apr 27, 2023
Merged

Conversation

troian
Copy link
Contributor

@troian troian commented Apr 26, 2023

  • add option to enable/disable colored output when consoleWriter being used (non JSON output)
  • add option to customize/disable log timestamps

new options do not change default behavior,
but give coller ability to fine tune log configuration

disable color and timestamps is handy when service like cosmovisor or cosmos-sdk based node runs in kubernetes environment, as kubernetes does not colors
and output looks cluttered.

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@troian troian requested a review from a team as a code owner April 26, 2023 14:53
@github-prbot github-prbot requested review from a team and removed request for a team April 26, 2023 14:53
@github-actions github-actions bot added the C:log label Apr 26, 2023
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

Nice! Could you add a changelog under log/CHANGELOG.md (in unreleased section)

log/options.go Outdated Show resolved Hide resolved
@troian
Copy link
Contributor Author

troian commented Apr 26, 2023

@julienrbrt addressed all the comments

log/CHANGELOG.md Outdated Show resolved Hide resolved
log/logger.go Outdated Show resolved Hide resolved
@troian troian force-pushed the log-options branch 2 times, most recently from 072cd68 to 332f623 Compare April 26, 2023 17:14
@julienrbrt
Copy link
Member

@troian could you rebase? Then we can merge.

@troian
Copy link
Contributor Author

troian commented Apr 26, 2023

@julienrbrt done
would you also please cut a new release for the log package? I'm going to submit PR to a cosmovisor shortly after

@julienrbrt julienrbrt enabled auto-merge April 26, 2023 20:39
Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

lgtm

@julienrbrt
Copy link
Member

Could you rebase again :)

- add option to enable/disable colored output when
  consoleWriter being used (non JSON output)
- add option to customize/disable log timestamps

new options do not change default behavior,
but give coller ability to fine tune log configuration

disable color and timestamps is handy when service like
cosmovisor or cosmos-sdk based node runs in kubernetes
environment, as kubernetes does not colors
and output looks cluttered.

Signed-off-by: Artur Troian <[email protected]>
auto-merge was automatically disabled April 27, 2023 18:52

Head branch was pushed to by a user without write access

@julienrbrt julienrbrt enabled auto-merge April 27, 2023 19:18
@julienrbrt julienrbrt added this pull request to the merge queue Apr 27, 2023
Merged via the queue into cosmos:main with commit be5e3aa Apr 27, 2023
@julienrbrt
Copy link
Member

Tagged cosmossdk.io/log v1.1.0 with this. I'll let dependabot bump it in all our packages.

@troian troian deleted the log-options branch April 27, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants