Documentation ¶
Overview ¶
Package log wraps Go's log package and provide a simple level-able and color-able logging package. It has 5 levels of logging in order from highest to lowest as listed below. The default is Info.
Error > Warning > Info > Debug > Trace
Package log is licensed in GPLv3.
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func SetFlags(flag int)
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Traceln(v ...interface{})
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- func Warningln(v ...interface{})
Constants ¶
const ( Ldate = 1 << iota // the date in the local time zone: 2009/01/23 Ltime // the time in the local time zone: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile LUTC // if Ldate or Ltime is set, use UTC rather than the local time zone Ltrace // Ltrace indicates logging trace level event Ldebug // Ldebug indicates logging debug level event Linfo // Linfo indicates logging info level event Lwarning // Lwarning indicates logging warning level event Lerror // Lerror indicates logging error level event LstdFlags = Ldate | Ltime | Linfo // initial values for the standard logger )
These flags define which text to prefix to each log entry generated by the Logger. Bits are or'ed together to control what's printed. There is no control over the order they appear (the order listed here) or the format they present (as described in the comments). The prefix is followed by a colon only when Llongfile or Lshortfile is specified. For example, flags Ldate | Ltime (or LstdFlags) produce,
2009/01/23 01:23:23 message
while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,
2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
Variables ¶
var Fatal = log.Fatal // func Fatal(v ...interface{})
Fatal is an alias to Go's log.Fatal, which prints logging event to the standard logger followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Print.
NOTE: No color output.
var Fatalf = log.Fatalf // func Fatalf(format string, v ...interface{})
Fatalf is an alias to Go's log.Fatalf, which prints logging event to the standard logger followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Printf.
NOTE: No color output.
var Fatalln = log.Fatalln // func Fatalln(v ...interface{})
Fatalln is an alias to Go's log.Fatalln, which prints logging event to the standard logger followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Println.
NOTE: No color output.
var Panic = log.Panic // func Panic(v ...interface{})
Panic is an alias to Go's log.Panic, which prints logging event to the standard logger followed by a call to panic(). Arguments are handled in the manner of fmt.Print.
NOTE: No color output.
var Panicf = log.Panicf // func Panicf(format string, v ...interface{})
Panicf is an alias to Go's log.Panicf, which prints logging event to the standard logger followed by a call to panic(). Arguments are handled in the manner of fmt.Printf.
NOTE: No color output.
var Panicln = log.Panicln // func Panicln(v ...interface{})
Panicln is an alias to Go's log.Panicln, which prints logging event to the standard logger followed by a call to panic(). Arguments are handled in the manner of fmt.Println.
NOTE: No color output.
var Print = log.Print // func Print(v ...interface{})
Print is an alias to Go's log.Print, which prints logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
NOTE: No color output.
var Printf = log.Printf // func Printf(format string, v ...interface{})
Printf is an alias to Go's log.Printf, which prints logging event to the standard logger. Arguments are handled in the manner of fmt.Printf.
NOTE: No color output.
var Println = log.Println // func Println(v ...interface{})
Println is an alias to Go's log.Println, which prints logging event to the standard logger. Arguments are handled in the manner of fmt.Println.
NOTE: No color output.
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug writes debug level logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf writes debug level logging event to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Debugln ¶
func Debugln(v ...interface{})
Debugln writes debug level logging event to the standard logger. Arguments are handled in the manner of fmt.Println.
func Error ¶
func Error(v ...interface{})
Error writes error level logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf writes error level logging event to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Errorln ¶
func Errorln(v ...interface{})
Errorln writes error level logging event to the standard logger. Arguments are handled in the manner of fmt.Println.
func Info ¶
func Info(v ...interface{})
Info writes info level logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
func Infof ¶
func Infof(format string, v ...interface{})
Infof writes info level logging event to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Infoln ¶
func Infoln(v ...interface{})
Infoln writes info level logging event to the standard logger. Arguments are handled in the manner of fmt.Println.
func Trace ¶
func Trace(v ...interface{})
Trace writes trace level logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef writes trace level logging event to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Traceln ¶
func Traceln(v ...interface{})
Traceln writes trace level logging event to the standard logger. Arguments are handled in the manner of fmt.Println.
func Warning ¶
func Warning(v ...interface{})
Warning writes warning level logging event to the standard logger. Arguments are handled in the manner of fmt.Print.
Types ¶
This section is empty.