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

msg is a reserved property name in Chronicles #321

Merged
merged 1 commit into from
Aug 7, 2020
Merged

Conversation

zah
Copy link
Contributor

@zah zah commented Aug 7, 2020

Every Chronicles log record has an existing msg property matching
the static string supplied in the log statement. Thus, it's currently
not possible to use msg as the name of a user property:

status-im/nim-chronicles#86

Every Chronicles log record has an existing `msg` property matching
the static string supplied in the log statement. Thus, it's currently
not possible to use `msg` as the name of a user property:

status-im/nim-chronicles#86
@@ -132,7 +132,7 @@ proc send*(
timeout: Duration = DefaultSendTimeout) {.async.} =
logScope:
peer = p.id
msg = shortLog(msg)
rpcMsg = shortLog(msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe there might be many places in the codebase where msg is used... it's not an issue to change those, but it seems like a very big pitfall to have a reserved word in chronicles and not warn about it when used as a field, imo chronicles should warn about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

myeah, half of our code deals withmsg:s, sad to not be able to use it

Copy link
Contributor

Choose a reason for hiding this comment

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

This PR fixes a problem which we currently have, nim-libp2p producing incorrect json log lines.

@dryajov
Copy link
Contributor

dryajov commented Aug 7, 2020

ok, merging... not something to bikeshed right now.

@dryajov dryajov merged commit fbb59c3 into master Aug 7, 2020
@dryajov dryajov deleted the logging-fix branch August 7, 2020 22:46
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.

4 participants