Support `WithError` on `Logger`.

Should address #277.
This commit is contained in:
Graham Hughes 2015-11-21 22:59:38 -08:00
parent a22723f16e
commit 42c9c25263
1 changed files with 6 additions and 0 deletions

View File

@ -64,6 +64,12 @@ func (logger *Logger) WithFields(fields Fields) *Entry {
return NewEntry(logger).WithFields(fields)
}
// Add an error as single field to the log entry. All it does is call
// `WithError` for the given `error`.
func (logger *Logger) WithError(err error) *Entry {
return NewEntry(logger).WithError(err)
}
func (logger *Logger) Debugf(format string, args ...interface{}) {
if logger.Level >= DebugLevel {
NewEntry(logger).Debugf(format, args...)