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

Rework how we store log fields #81

merged 7 commits into from Jul 15, 2022


Copy link

@detro detro commented Jul 15, 2022

Closes #75

@detro detro requested a review from a team as a code owner Jul 15, 2022
@detro detro added this to the v0.6.0 milestone Jul 15, 2022
bflad approved these changes Jul 15, 2022
Copy link

@bflad bflad left a comment

Excellent work! This looks good to me 🚀

result := make([]string, 0, len(maps[0]))

for k := range maps[0] {
result = append(result, k)

return result
Copy link

@bflad bflad Jul 15, 2022

Choose a reason for hiding this comment

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

If we wanted to be really fancy here, we could declare our own type FieldMap map[string]interface{}, which would give us a concise way to refer to these maps, and put this particular code into a Keys() method but really like not at all important or necessary to do! 😄

Copy link
Contributor Author

@detro detro Jul 15, 2022

Choose a reason for hiding this comment

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

Will create a follow up to have tailor made types like FieldMap and FieldMaps.

Ivan De Marino added 7 commits Jul 15, 2022
…field maps"

"Field maps" are `map[string]interface{}`, that carry additional fields we want the logging library to attach to logs
… options

This is what gets stored in the context with each log, and will now carry the fields we want to append to logs directly (as a map),
instead of relying on the `hclog` `ImpliedArgs` facility.

This doesn't change the interface of the library, but it changes where the fields are stored before they are logged.
Just shortcuts for go commands
@detro detro force-pushed the detro/75-rework_how_we_store_log_fields branch from 492f8dc to 118690f Compare Jul 15, 2022
@detro detro merged commit a2e3687 into main Jul 15, 2022
4 checks passed
@detro detro deleted the detro/75-rework_how_we_store_log_fields branch Jul 15, 2022
Copy link

github-actions bot commented Aug 15, 2022

I'm going to lock this pull request because it has been closed for 30 days . This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging this pull request may close these issues.

Rework the SetField(key, val) function to use a dedicated map[string]interface{} to store implicit arguments
2 participants