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

JSON log output #1027

Merged
merged 10 commits into from
Sep 14, 2022
Merged

JSON log output #1027

merged 10 commits into from
Sep 14, 2022

Conversation

markphelps
Copy link
Collaborator

@markphelps markphelps commented Sep 12, 2022

Fixes #992

CleanShot 2022-09-13 at 09 53 56

  1. Adds support for encoding log output as JSON using either FLIPT_LOG_ENCODING env var or setting log.encoding via yaml
  2. Only prints banner and api/ui addrs as text if we're running in console mode

/cc @GeorgeMac

TODO

  • Update docs

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2022

Codecov Report

Merging #1027 (01cb0b0) into main (4914fdf) will decrease coverage by 0.04%.
The diff coverage is 71.42%.

@@            Coverage Diff             @@
##             main    #1027      +/-   ##
==========================================
- Coverage   81.26%   81.21%   -0.05%     
==========================================
  Files          17       17              
  Lines        1799     1805       +6     
==========================================
+ Hits         1462     1466       +4     
- Misses        263      265       +2     
  Partials       74       74              
Impacted Files Coverage Δ
config/config.go 89.14% <71.42%> (-0.54%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@markphelps markphelps requested a review from tsickert September 12, 2022 23:52
@GeorgeMac
Copy link
Member

@markphelps nice. Yeah, might be worth dropping the banner when the encoding is JSON.

As you say, the JSON encoder is likely to imply the output of the logging here is machine-readable.
However, piping it to jq or down to a central logging system will likely break that with the banner.

@markphelps markphelps marked this pull request as ready for review September 13, 2022 13:55
Copy link
Member

@GeorgeMac GeorgeMac left a comment

Choose a reason for hiding this comment

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

Looks great. Couple take it or leave it suggestions.

cmd/flipt/main.go Outdated Show resolved Hide resolved
cmd/flipt/main.go Outdated Show resolved Hide resolved
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.

Json log formatter
3 participants