diff --git a/level.go b/level.go index baf8887..7b1004f 100644 --- a/level.go +++ b/level.go @@ -3,7 +3,6 @@ package beaver import ( "fmt" "strings" - "time" "go.jolheiser.com/beaver/color" ) @@ -105,38 +104,3 @@ func ParseLevel(level string) Level { } return INFO } - -func timePrefix(t time.Time) string { - var buf = &[]byte{} - year, month, day := t.Date() - itoa(buf, int(month), 2) - *buf = append(*buf, '/') - itoa(buf, day, 2) - *buf = append(*buf, '/') - itoa(buf, year, 4) - *buf = append(*buf, ' ') - - hour, min, sec := t.Clock() - itoa(buf, hour, 2) - *buf = append(*buf, ':') - itoa(buf, min, 2) - *buf = append(*buf, ':') - itoa(buf, sec, 2) - - return string(*buf) -} - -func itoa(buf *[]byte, i int, wid int) { - var b [20]byte - bp := len(b) - 1 - for i >= 10 || wid > 1 { - wid-- - q := i / 10 - b[bp] = byte('0' + i - q*10) - bp-- - i = q - } - // i < 10 - b[bp] = byte('0' + i) - *buf = append(*buf, b[bp:]...) -} diff --git a/logger.go b/logger.go index d586d9b..39c096d 100644 --- a/logger.go +++ b/logger.go @@ -42,7 +42,7 @@ func (l *Logger) write(level Level, text string) { if l.Level <= level { var message string if l.Format.TimePrefix { - message += color.Time.Format(timePrefix(time.Now())) + " " + message += color.Time.Format(time.Now().Format("01/02/2006 15:04:05")) + " " } if l.Format.StackPrefix { _, file, line, _ := runtime.Caller(l.skip)