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: Add structured logging #502

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: Add structured logging #502

wants to merge 2 commits into from

Conversation

ctlong
Copy link
Member

@ctlong ctlong commented May 10, 2024

Description

Adds structured logging to Log Cache. Always outputs logs using RFC3339 timestamps.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing performed?

  • Unit tests
  • Integration tests
  • Acceptance tests

Checklist:

  • This PR is being made against the main branch, or relevant version branch
  • I have made corresponding changes to the documentation
  • I have added testing for my changes

If you have any questions, or want to get attention for a PR or issue please reach out on the #logging-and-metrics channel in the cloudfoundry slack

ctlong added 2 commits May 9, 2024 21:49
Uses the new structured logger in lieu of the standard logger.

cmd/gateway:
- Inits structured logger to a text handler that outputs to stderr.
- Panics instead of logging fatally if config cannot be loaded.
- If config cannot be written out to stderr, logs an error instead of
  logging fatally.
- Passes the handler to lower packages in the guise of standard logger.

internal/gateway:
- Uses default slog for logging, will inherit the slog from cmd/gateway.
- Tests set slog output to GinkgoWriter so that logs are only output on
  test failures.
- Removes unnecessary WithGatewayLogger option.
- Panics instead of logging fatally in several cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting for Changes | Open for Contribution
Development

Successfully merging this pull request may close these issues.

1 participant