1. Logging that provides logging levels.
As you noted, log package in go standard library doesn't provide that
but you can trivially write your own.
2. Excluding some functions depending on the build type.
In C, one way to do it is to use preprocessor. Go doesn't have that
but you can do it differently.
Let's, for example, assume you have a function (Log*) Debug(string s).
You can have 2 different implementation in 2 different files, e.g.
debug_release_build.go and debug_debug_build.go where implementation
in debug_release_build.go would have a no-op implementation.
Then in your build system (e.g. make or whatever build system you use)
you compile either debug_release_build.go or debug_debug_build.go
files. Note that this technique would work in C/C++ as well.
I can't guarantee that current Go compiler is smart enough to fully
exclude code of the no-op implementation (something you can verify
yourself) but even if it doesn't, you probably would have grounds for
opening a bug report.
-- kjk
Perhaps log4go package has the features you are looking for.
http://code.google.com/p/log4go/
It will be nice if App Engine logging with its multiple log levels can somehow be unified with the standard log package.
The appropriate level of a log message is based on the requirements of
the user/admin not the developer. The developer can't actually know what
an appropriate level of a log message should be.
The http package writes log messages, what level should they be at?
The answer is going to be different for every user of the http package.
The same goes for every other package that needs to log.
- jessta
godoc syslog
I understand that, but what can't the standard library log package provide a better interface to developers? Even if standard packages didn't log, I would consider it really useful to have a better log package as a developer.