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

zerolog.Logger methods should be on *Logger, not value type #1

Closed
davecheney opened this issue May 16, 2017 · 5 comments
Closed

zerolog.Logger methods should be on *Logger, not value type #1

davecheney opened this issue May 16, 2017 · 5 comments

Comments

@davecheney
Copy link

No description provided.

@davecheney davecheney changed the title zerlog.Logger methods should be on *Logger, not sure value type zerlog.Logger methods should be on *Logger, not value type May 17, 2017
@davecheney davecheney changed the title zerlog.Logger methods should be on *Logger, not value type zerolog.Logger methods should be on *Logger, not value type May 17, 2017
@rs
Copy link
Owner

rs commented May 20, 2017

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 New return a ponter too and would force an allocation, even for temporarty (i.e. per request) sub-loggers you want to pass on the stack.

@nicbaz
Copy link

nicbaz commented Jun 17, 2017

@davecheney could you please elaborate ? Is this for consistency reasons ? Efficiency ?

@davecheney
Copy link
Author

davecheney commented Jun 19, 2017 via email

@rs
Copy link
Owner

rs commented Jun 19, 2017

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.

@dcheney-atlassian
Copy link

ok, my mistake, please close this issue.

@rs rs closed this as completed Jun 19, 2017
rs pushed a commit that referenced this issue Aug 16, 2021
* Create dependabot.yml
* Update test.yml
* Bump golang.org/x/tools from 0.1.3 to 0.1.5 (#1)
* Bump github.com/rs/xid from 1.2.1 to 1.3.0 (#2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

No branches or pull requests

4 participants