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(logging): support custom time, level and message keys #1295

Merged
merged 3 commits into from
Jan 30, 2023

Conversation

GeorgeMac
Copy link
Contributor

Fixes FLI-148
Fixes #1252

Adds support for custom keys in log output for:

  • time
  • level
  • message

Each key can be configured under the log.keys object in the configuration.

Using the following Flipt configuration I get the subsequent logging output format:

config.yaml:

log:
  level: DEBUG
  encoding: json
  keys:
    time: "time"
    level: "level"
    message: "msg"

Flipt output:

{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"flipt starting","version":"dev","commit":"","date":"","go_version":"go1.19.5"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"not a release version, disabling telemetry"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"local state directory exists","path":"/Users/georgemac/Library/Application Support/flipt"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"using driver","driver":"sqlite3"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"migrations up to date"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"store enabled","server":"grpc","driver":"sqlite3"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"authentication method \"token\" server registered","server":"grpc"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"authentication method \"oidc\" server registered","server":"grpc"}
{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"authentication middleware enabled","server":"grpc"}
{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"cleanup process not acquired","server":"grpc","next_attempt":"2023-01-27T12:49:10Z"}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"starting grpc server","server":"grpc"}
{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"CORS enabled","server":"http","allowed_origins":["http://localhost:5173","http://localhost:8080"]}
{"level":"DEBUG","time":"2023-01-27T12:39:30Z","msg":"starting http server","server":"http"}
{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"api available","server":"http","address":"http://0.0.0.0:8080/api/v1"}
{"level":"INFO","time":"2023-01-27T12:39:30Z","msg":"ui available","server":"http","address":"http://0.0.0.0:8080"}

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2023

Codecov Report

Merging #1295 (21f3929) into main (9eef7e5) will increase coverage by 0.03%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #1295      +/-   ##
==========================================
+ Coverage   79.88%   79.92%   +0.03%     
==========================================
  Files          43       43              
  Lines        3267     3272       +5     
==========================================
+ Hits         2610     2615       +5     
  Misses        527      527              
  Partials      130      130              
Impacted Files Coverage Δ
internal/config/log.go 100.00% <100.00%> (ø)

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

Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

♥️it! lets verify with @giddel that it would fix their issue/usecase in #1252 and also queue up a docs update PR for the new config keys!

🤩

@GeorgeMac
Copy link
Contributor Author

GeorgeMac commented Jan 27, 2023

Added the associated docs PR here flipt-io/docs#24

@GeorgeMac GeorgeMac enabled auto-merge (squash) January 30, 2023 12:28
@GeorgeMac GeorgeMac merged commit 338c495 into main Jan 30, 2023
@GeorgeMac GeorgeMac deleted the gm/additional-logging-parameters branch January 30, 2023 14:47
markphelps added a commit that referenced this pull request Jan 31, 2023
* main:
  chore: bump prom verison (#1305)
  Otel improvements (#1306)
  fix: disable csp headers in non-release mode for ui dev (#1304)
  chore(deps): bump go.opentelemetry.io/otel/exporters/jaeger (#1299)
  chore(deps): bump google.golang.org/grpc from 1.52.0 to 1.52.3 (#1303)
  feat(logging): support custom time, level and message keys (#1295)
  fix: get linter running correctly locally (#1296)
  chore(deps): bump go.opentelemetry.io/otel from 1.11.2 to 1.12.0 (#1301)
  chore(deps): bump golangci/golangci-lint-action from 3.3.1 to 3.4.0 (#1298)
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.

[FLI-148] posibility to configure Zap logger keys
3 participants