/usr/share/gocode/src/github.com/juju/loggo/formatter.go is in golang-juju-loggo-dev 0.0~git20150318-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | // Copyright 2014 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package loggo
import (
"fmt"
"path/filepath"
"time"
)
// Formatter defines the single method Format, which takes the logging
// information, and converts it to a string.
type Formatter interface {
Format(level Level, module, filename string, line int, timestamp time.Time, message string) string
}
// DefaultFormatter provides a simple concatenation of all the components.
type DefaultFormatter struct{}
// Format returns the parameters separated by spaces except for filename and
// line which are separated by a colon. The timestamp is shown to second
// resolution in UTC.
func (*DefaultFormatter) Format(level Level, module, filename string, line int, timestamp time.Time, message string) string {
ts := timestamp.In(time.UTC).Format("2006-01-02 15:04:05")
// Just get the basename from the filename
filename = filepath.Base(filename)
return fmt.Sprintf("%s %s %s %s:%d %s", ts, level, module, filename, line, message)
}
|