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: enable renaming meta fields #217

Merged
merged 4 commits into from
Jan 25, 2025
Merged

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