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

Improve server logging in json format #140

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Improve server logging in json format #140

merged 1 commit into from
Apr 4, 2024

Conversation

agbpatro
Copy link
Collaborator

@agbpatro agbpatro commented Apr 2, 2024

Description

Fleet telemetry has a config to set server logging in json mode here. However the logs aren't in json format. This PR formats all logs in json format if flag is set

before

time="2024-04-02T18:51:12Z" level=info msg=starting
time="2024-04-02T18:51:12Z" level=info msg=status_server_configured
time="2024-04-02T18:51:12Z" level=info msg=profiler_started
time="2024-04-02T18:51:12Z" level=info msg="registered kafka for namespace: tesla_telemetry"
time="2024-04-02T18:51:12Z" level=info msg="registered pubsub for project: test-project-id, namespace: tesla_telemetry"
time="2024-04-02T18:51:12Z" level=info msg="appending custom CA file :/etc/tesla/certs/server/vehicle_device.CA.cert"

now

{"activity":true,"context":"fleet-telemetry","level":"info","msg":"starting_server","time":"2024-04-02T18:47:00Z"}
{"activity":true,"context":"fleet-telemetry","level":"info","msg":"status_server_configured","time":"2024-04-02T18:47:00Z"}
{"activity":true,"context":"fleet-telemetry","level":"info","msg":"profiler_started","port":4269,"time":"2024-04-02T18:47:00Z"}
{"activity":true,"context":"fleet-telemetry","level":"info","msg":"kafka_registered","namespace":"tesla_telemetry","time":"2024-04-02T18:47:00Z"}
{"activity":true,"context":"fleet-telemetry","level":"info","msg":"pubsub_registerd","namespace":"tesla_telemetry","project":"test-project-id","time":"2024-04-02T18:47:00Z"}
{"activity":true,"ca_file_path":"/etc/tesla/certs/server/vehicle_device.CA.cert","context":"fleet-telemetry","level":"info","msg":"custom_ca_file_appened","time":"2024-04-02T18:47:00Z"}

Fixes # (issue)

Type of change

Please select all options that apply to this change:

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

Checklist:

Confirm you have completed the following steps:

  • My code follows the style of this project.
  • I have performed a self-review of my code.
  • I have made corresponding updates to the documentation.
  • I have added/updated unit tests to cover my changes.
  • I have added/updated integration tests to cover my changes.

@agbpatro agbpatro requested review from ThomasAlxDmy, aaronpkahn and vmallet and removed request for ThomasAlxDmy and aaronpkahn April 2, 2024 20:22
@agbpatro agbpatro merged commit d192938 into main Apr 4, 2024
3 checks passed
@agbpatro agbpatro deleted the custom_logger branch April 4, 2024 05:44
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.

None yet

2 participants