Merge pull request #299 from gchpaco/master

Support `WithError` on `Logger`.
This commit is contained in:
Simon Eskildsen 2015-11-23 03:15:15 -05:00
commit cdaedc68f2
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...)