text_formatter: move relative time logic from entry

This commit is contained in:
Simon Eskildsen 2014-05-03 20:43:55 -04:00
parent 11a9ddab08
commit 13600d2325
2 changed files with 9 additions and 8 deletions

View File

@ -15,14 +15,6 @@ type Entry struct {
var baseTimestamp time.Time
func init() {
baseTimestamp = time.Now()
}
func miniTS() int {
return int(time.Since(baseTimestamp) / time.Second)
}
func NewEntry(logger *Logger) *Entry {
return &Entry{
Logger: logger,

View File

@ -4,6 +4,7 @@ import (
"fmt"
"sort"
"strings"
"time"
)
const (
@ -14,6 +15,14 @@ const (
blue = 34
)
func init() {
baseTimestamp = time.Now()
}
func miniTS() int {
return int(time.Since(baseTimestamp) / time.Second)
}
type TextFormatter struct {
// Set to true to bypass checking for a TTY before outputting colors.
ForceColors bool