Documentation ¶
Overview ¶
Package debug provides log and trace facilities as enabled or disabled with these build tags: fixme, diag, nolog, notrace.
Index ¶
- Constants
- Variables
- func Create(fn string) (*os.File, error)
- func FilterDepth(v ...interface{}) (int, []interface{})
- func Redirect(v interface{}) error
- type Debug
- func (x *Debug) Depth(v ...interface{}) (int, []interface{})
- func (x *Debug) Diag(v ...interface{})
- func (x *Debug) Diagf(format string, v ...interface{})
- func (x *Debug) Failure(v ...interface{})
- func (x *Debug) Failuref(format string, v ...interface{})
- func (x *Debug) Fixme(v ...interface{})
- func (x *Debug) Fixmef(format string, v ...interface{})
- func (x *Debug) Log(v ...interface{})
- func (x *Debug) Logf(format string, v ...interface{})
- func (x *Debug) Reset()
- func (x *Debug) Set(v interface{}) (err error)
- func (x *Debug) String() string
- func (x *Debug) Trace(v ...interface{})
- type Depth
- type Id
- type Logger
- type Tracer
Constants ¶
const ( DefaultDepth = 2 TraceSize = 64 )
Variables ¶
var Trace = &Tracer{}
Functions ¶
func FilterDepth ¶
func FilterDepth(v ...interface{}) (int, []interface{})
FilterDepth strips any such parameter given as the first or last item of the variadic argument.
Usage:
debuf.FilterDepth(debug.Depth(3), err)
Types ¶
type Debug ¶
type Debug string
Include Debug as an annonymous member of any structure to add FIXME[f], Diag[f], Log, and Trace methods.
Usage:
var foo struct { debug.Debug ... } ... foo.Debug.Set("foo") ... foo.FIXME(...) foo.Diag(...) foo.Log(...) foo.Trace(...)
func (*Debug) Depth ¶
Depth strips any such parameter given as the first or last item of the variadic argument.
Usage:
foo.Diag(debug.Depth(3), err)
func (*Debug) Diag ¶
func (x *Debug) Diag(v ...interface{})
Diag, after stripping any leading or trailing DEPTH parameters, sends Println(v...) output to the Diag logger; either syslog INFO or a redirected file.
func (*Debug) Failure ¶
func (x *Debug) Failure(v ...interface{})
Failure, after stripping any leading or trailing DEPTH parameters, sends Println(v...) output to the Failure logger; either syslog DEBUG or a redirected file.
func (*Debug) Fixme ¶
func (x *Debug) Fixme(v ...interface{})
Fixme, after stripping any leading or trailing DEPTH parameters, sends Println(v...) output to the Fixme logger; either syslog DEBUG or a redirected file.
func (*Debug) Log ¶
func (x *Debug) Log(v ...interface{})
Log sends Println(v...) output to the logger; either syslog NOTICE or a redirected file.
type Depth ¶
type Depth int
Depth may be included as the first or last variadic parameter to the Diag and FIXME methods to change the back trace from the default, 2.
type Id ¶
type Id uint8
If the first (*Debug).Trace() parameter is an Id, it's used as a key in the trace filter map that qualifies whether the remaining variadic arguments are Println()'d to the trace ring.
type Logger ¶
Logger is a wrapper for the standard library.
var Failure, Fixme, Diag, Log *Logger
Directories ¶
Path | Synopsis |
---|---|
Package accumulator provides an integer wrapper with a pointer receiver method to sum results of Read, ReadFrom, Write and WriteTo signatures.
|
Package accumulator provides an integer wrapper with a pointer receiver method to sum results of Read, ReadFrom, Write and WriteTo signatures. |
Package file provides a wrapper to os.File that, when built with both "diag" and "file" tags (e.g.
|
Package file provides a wrapper to os.File that, when built with both "diag" and "file" tags (e.g. |
Package mutex provides a wrapper interface to sync.Mutex that, when built with both "diag" and "mutex" tags (e.g.
|
Package mutex provides a wrapper interface to sync.Mutex that, when built with both "diag" and "mutex" tags (e.g. |