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

add global logger for some quick use #97

Closed
wants to merge 2 commits into from
Closed

add global logger for some quick use #97

wants to merge 2 commits into from

Conversation

c0mm4nd
Copy link
Contributor

@c0mm4nd c0mm4nd commented Jun 14, 2020

No description provided.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution but I'm not sure this pulls its weight. You should never actually use this logger in production and constructing a logger is pretty easy in practice.

Note: you can easily create a centralized logging package in your project to implement this, if it's really crucial.

}

func ReplaceGlobalLogger(logger *ZapEventLogger) (undo func()) {
globalMu.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

This isn't safe for concurrent use. You'd need to take the lock while accessing the global logger as well.

@Kubuxu
Copy link
Member

Kubuxu commented Jun 18, 2020

It is also a no for me.

It is as simple as:

var log = logging.Logger("[subsystem]")

to set up a logger.

@c0mm4nd
Copy link
Contributor Author

c0mm4nd commented Jun 18, 2020

Personally I think a lib named log should at least have similar usage with go's log.

@Stebalien
Copy link
Member

This package is not trying to mimic go log's API.

@Stebalien Stebalien closed this Jun 18, 2020
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.

3 participants