Skip to content

Conversation

@atusy
Copy link
Contributor

@atusy atusy commented Nov 18, 2024

I want to rename meta data fields in JSON log so that I can align the names with logs from other products.

The syntax is just like dplyr::rename.

The example renames time to timestamp.

> logger::log_formatter(logger::formatter_json)
> logger::log_layout(logger::layout_json_parser(fields = c(timestamp = "time", "level", "ns", "fn")))
> logger::log_warn(message = "this is a warning")
{"timestamp":"2024-11-19 00:16:22","level":"WARN","ns":"global","fn":"NA","message":"this is a warning"}

@daroczig
Copy link
Owner

This is super cool, thank you 🙇

Could you please add that example to the function's docs and preferably to the unit tests (test-layouts.R) as well?

@atusy
Copy link
Contributor Author

atusy commented Jan 25, 2025

@daroczig
Thanks! I added the both :)

@daroczig daroczig merged commit d7b4735 into daroczig:main Jan 25, 2025
14 checks passed
@daroczig
Copy link
Owner

thanks a ton 🙇

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.

2 participants