Adds WithTime to Logger and Entry types, as well as a pure module-level function.

This commit is contained in:
Simon Brisson
2018-06-29 10:53:51 -04:00
parent 52b92f5b89
commit 725f3be199
4 changed files with 84 additions and 1 deletions
+10
View File
@@ -2,6 +2,7 @@ package logrus
import (
"io"
"time"
)
var (
@@ -72,6 +73,15 @@ func WithFields(fields Fields) *Entry {
return std.WithFields(fields)
}
// WithTime creats an entry from the standard logger and overrides the time of
// logs generated with it.
//
// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
// or Panic on the Entry it returns.
func WithTime(t time.Time) *Entry {
return std.WithTime(t)
}
// Debug logs a message at level Debug on the standard logger.
func Debug(args ...interface{}) {
std.Debug(args...)