Documentation ¶
Index ¶
- Constants
- Variables
- func Backtrace(size int) []string
- func Darwin() bool
- func Debug(arg string)
- func Debugf(msg string, args ...interface{})
- func Error(msg string, err error)
- func FileExists(path string) (bool, error)
- func Info(arg string)
- func Infof(msg string, args ...interface{})
- func InitLogger(level string)
- func MemoryUsage() string
- func Nows() string
- func ParseTime(str string) (time.Time, error)
- func RandomJid() string
- func ReadLines(data []byte) ([]string, error)
- func Thens(tim time.Time) string
- func Warn(arg string)
- func Warnf(msg string, args ...interface{})
- type LogHandler
- type Logger
Constants ¶
View Source
const (
TimeFormat = "2006-01-02T15:04:05.000Z"
)
View Source
const ( // This is the canonical timestamp format used by Faktory. // Always UTC, lexigraphically sortable. This is the best // timestamp format, accept no others. TimestampFormat = time.RFC3339Nano )
Variables ¶
View Source
var ( LogInfo = false LogDebug = false )
View Source
var Colors = [...]int{ alog.DebugLevel: gray, alog.InfoLevel: blue, alog.WarnLevel: yellow, alog.ErrorLevel: red, alog.FatalLevel: red, }
Colors mapping.
View Source
var Strings = [...]string{ alog.DebugLevel: "D", alog.InfoLevel: "I", alog.WarnLevel: "W", alog.ErrorLevel: "E", alog.FatalLevel: "F", }
Strings mapping.
Functions ¶
func Backtrace ¶
Backtrace gathers a backtrace for the caller. Return a slice of up to N stack frames.
func Debugf ¶
func Debugf(msg string, args ...interface{})
Verbosity level helps track down production issues:
-l debug
func InitLogger ¶
func InitLogger(level string)
func MemoryUsage ¶
func MemoryUsage() string
Types ¶
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
type Logger ¶
type Logger interface { Debug(arg string) Debugf(format string, args ...interface{}) Info(arg string) Infof(format string, args ...interface{}) Warn(arg string) Warnf(format string, args ...interface{}) Error(arg string) Errorf(format string, args ...interface{}) // Log and terminate process (unrecoverable) Fatal(arg string) // Log with fmt.Printf-like formatting and terminate process (unrecoverable) Fatalf(format string, args ...interface{}) // Set key/value context for further logging with the returned logger WithField(key string, value interface{}) *alog.Entry // Set key/value context for further logging with the returned logger WithFields(keyValues alog.Fielder) *alog.Entry // Return a logger with the specified error set, to be included in a subsequent normal logging call WithError(err error) *alog.Entry }
This generic logging interface hide a Logrus logger or another impl
Click to show internal directories.
Click to hide internal directories.