Navigation Menu

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

log: Request for advanced logging. #2236

Closed
gopherbot opened this issue Sep 6, 2011 · 4 comments
Closed

log: Request for advanced logging. #2236

gopherbot opened this issue Sep 6, 2011 · 4 comments

Comments

@gopherbot
Copy link

by awreece:

The log package in go does not have support for several nice features available in the
google-glog C++ logging library: http://code.google.com/p/google-glog/
1) The ability to specify verbosity levels (LOG(INFO) vs LOG(WARNING)).
2) The ability to conditionally log (LOG_IF...).
3) The ability to log every N (LOG_EVERY_N...).
4) The ability to log first N (LOG_FIRST_N...).

Or more advanced features, such as:
1) User specified verbosity levels (VLOG(3)...).
2) Verbosity levels enabled by module (--vmodule=mapreduce=2).
3) CHECK macros to verify expectations of the code.
@robpike
Copy link
Contributor

robpike commented Sep 6, 2011

Comment 1:

Go does not have the C++ features that the Google logging package needs to provide the
functionality you ask for.  No macros, for one thing.  More generally, there is no way
to provide logging levels efficiently, since the arguments would always be evaluated
even if the logging call is not going to produce any output.
Because these features cannot be provided well, they will not be provided at all. There
are external implementations of logging that are prepared to make the compromise
differently; perhaps they can help you.

Status changed to WontFix.

@gopherbot
Copy link
Author

Comment 2 by awreece:

As I understand, the Google C++ logging package evaluates the arguments whether or not
they produce any output (for example, I know it evaluates the parameters of CHECK  and
LOG expressions but I do not know whether or not the streamed values are evaluated in
the case the CHECK or LOG would produce not output). If this "excessive" evaluation of
parameters is really an issue, then I understand the exclusion from the Go libraries
(although I would be interested in hearing the motivation behind this claim, especially
with regards to the motivation for making the default logging for the C++ library always
evaluate its parameters).
Is it just the issue of evaluating arguments? There appears to be the additional claim
that Go, lacking macros and a preprocessor, cannot support a clean logging package.

@rsc
Copy link
Contributor

rsc commented Sep 6, 2011

Comment 3:

The mailing list is a better place for open-ended discussions
like this one.  VLOG, LOG_IF, DCHECK, and so on definitely
do not evaluate their arguments when disabled.
Russ

@rsc
Copy link
Contributor

rsc commented Sep 6, 2011

Comment 4:

See package log for a clean logging package.
Russ

@mikioh mikioh changed the title Request for advanced logging. log: Request for advanced logging. Apr 12, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants