Documentation ¶
Index ¶
- Constants
- func DebugMode()
- func MinLevel(level level)
- func NewGlobal(w io.Writer)
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func SetFlags(flags int)
- func SetFormat(format format)
- func SetWriter(w io.Writer)
- func ToggleColor(value bool)
- type Logg
- func (l *Logg) Debug(args ...interface{})
- func (l *Logg) DebugMode()
- func (l *Logg) Debugf(format string, args ...interface{})
- func (l *Logg) Error(args ...interface{})
- func (l *Logg) Errorf(format string, args ...interface{})
- func (l *Logg) Info(args ...interface{})
- func (l *Logg) Infof(format string, args ...interface{})
- func (l *Logg) MinLevel(level level)
- func (l *Logg) Panic(args ...interface{})
- func (l *Logg) Panicf(format string, args ...interface{})
- func (l *Logg) Print(args ...interface{})
- func (l *Logg) Printf(format string, args ...interface{})
- func (l *Logg) SetFlags(flags int)
- func (l *Logg) SetFormat(format format)
- func (l *Logg) SetWriter(w io.Writer)
- func (l *Logg) ToggleColor(value bool)
- func (l *Logg) Warn(args ...interface{})
- func (l *Logg) Warnf(format string, args ...interface{})
- func (l *Logg) Write(b []byte) (n int, err error)
- func (l *Logg) Writer() io.Writer
Constants ¶
const ( DefaultFormat = Pretty DefaultColorOutput = true DefaultFlags = LstdFlags DefaultMinimumLevel = Info ContextCallDepth = 4 )
Default parameters
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 LstdFlags = Ldate | Ltime // 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
const ( Pretty format = iota Json )
Output formats
const ( Debug level = iota Info Error Warning Panic Empty level = -1 )
Log levels.
const ( Black int = iota Red Green Yellow Blue Magenta Cyan White )
Base colors for console
const ( HiBlack int = iota + 60 HiRed HiGreen HiYellow HiBlue HiMagenta HiCyan HiWhite )
High intensity colors
const ( Reset int = iota Bold Faint Italic Underline BlinkSlow BlinkRapid ReverseVideo Concealed CrossedOut )
Base attributes
Variables ¶
This section is empty.
Functions ¶
func ToggleColor ¶ added in v0.3.0
func ToggleColor(value bool)
Types ¶
type Logg ¶
type Logg struct {
// contains filtered or unexported fields
}
A Logg represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Logg's Write method.