daemon logging: unifying output and timestamps

A little refactor of the ./pkg/log so engine can have a logger instance

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts
2014-09-26 14:44:46 -04:00
parent 4547b6d529
commit 92df943fbf
8 changed files with 76 additions and 43 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"time"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/timeutils"
"github.com/docker/docker/utils"
)
@@ -255,6 +256,6 @@ func (eng *Engine) Logf(format string, args ...interface{}) (n int, err error) {
if !eng.Logging {
return 0, nil
}
prefixedFormat := fmt.Sprintf("[%s] %s\n", eng, strings.TrimRight(format, "\n"))
prefixedFormat := fmt.Sprintf("[%s] [%s] %s\n", time.Now().Format(timeutils.RFC3339NanoFixed), eng, strings.TrimRight(format, "\n"))
return fmt.Fprintf(eng.Stderr, prefixedFormat, args...)
}