-
Notifications
You must be signed in to change notification settings - Fork 575
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
zerolog.Logger methods should be on *Logger, not value type #1
Comments
Sorry I did not see this comment earlier. The Logger type is read-only on purpose. Do you see good reason to have those methods to be on ponters? It would imply that |
@davecheney could you please elaborate ? Is this for consistency reasons ? Efficiency ? |
Calling a method on a value type makes a copy of the reciever. This copying
has a performance overhead, but it also can break counters and lock
invariants, and can become a data race.
…On Sat, Jun 17, 2017 at 9:32 PM, Nicolas Bazire ***@***.***> wrote:
@davecheney <https://github.com/davecheney> could you please elaborate ?
Is this for consistency reasons ? Efficiency ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA28V26n2E9hzAPlBvAVyFax70jY2ks5sE7lJgaJpZM4Nb-2x>
.
|
Here there is no lock and most of the data in the struct are pointers. A logger is read-only and sub loggers are copies. Why would you make it a pointer? I see no good reason for it. |
ok, my mistake, please close this issue. |
No description provided.
The text was updated successfully, but these errors were encountered: