Documentation ¶
Index ¶
- Variables
- func Add(pathBase string) (subsystem string)
- func GetLoc(skip int, subsystem string) (output string)
- func SetLogLevel(l LogLevel)
- func SetTimeStampFormat(format string)
- type Bool
- type Chk
- type Duration
- func (d *Duration) Bool() bool
- func (d *Duration) Duration() time.Duration
- func (d *Duration) Float() float64
- func (d *Duration) FromString(s string) error
- func (d *Duration) Int() int64
- func (d *Duration) List() []string
- func (d *Duration) Set(du time.Duration)
- func (d *Duration) String() string
- func (d *Duration) Uint() uint64
- type Float
- type Int
- type LevelPrinter
- type LevelSpec
- type List
- type LogLevel
- type Logger
- type Meta
- type Printc
- type Printf
- type Println
- type Prints
- type String
- func (s *String) Bool() bool
- func (s *String) Duration() time.Duration
- func (s *String) Float() float64
- func (s *String) FromString(st string) error
- func (s *String) Int() int64
- func (s *String) List() []string
- func (s *String) Set(st string)
- func (s *String) String() string
- func (s *String) Uint() uint64
- type Struct
- type Uint
Constants ¶
This section is empty.
Variables ¶
var ( // App is the name of the application App = " main" // AllSubsystems stores all of the package subsystem names found in the current // application AllSubsystems []string )
var LevelSpecs = map[LogLevel]LevelSpec{ Off: gLS(Off, 0, 0, 0), Fatal: gLS(Fatal, 255, 0, 0), Error: gLS(Error, 255, 128, 0), Check: gLS(Check, 255, 255, 0), Warn: gLS(Warn, 255, 255, 0), Info: gLS(Info, 0, 255, 0), Debug: gLS(Debug, 0, 128, 255), Trace: gLS(Trace, 128, 0, 255), }
LevelSpecs specifies the id, string name and color-printing function
Functions ¶
func Add ¶ added in v0.0.3
Add adds a subsystem to the list of known subsystems and returns the string so it is nice and neat in the package logg.go file
func GetLoc ¶ added in v0.0.3
GetLoc calls runtime.Caller and formats as expected by source code editors for terminal hyperlinks
Regular expressions and the substitution texts to make these clickable in Tilix and other RE hyperlink configurable terminal emulators:
This matches the shortened paths generated in this command and printed at the very beginning of the line as this logger prints:
^((([\/a-zA-Z@0-9-_.]+/)+([a-zA-Z@0-9-_.]+)):([0-9]+)) /usr/local/bin/goland --line $5 $GOPATH/src/github.com/p9c/matrjoska/$2
I have used a shell variable there but tilix doesn't expand them, so put your GOPATH in manually, and obviously change the repo subpath.
func SetLogLevel ¶ added in v0.0.5
func SetLogLevel(l LogLevel)
func SetTimeStampFormat ¶ added in v0.0.5
func SetTimeStampFormat(format string)
Types ¶
type Bool ¶ added in v0.0.6
type Bool struct { Meta // contains filtered or unexported fields }
func (*Bool) FromString ¶ added in v0.0.6
type Duration ¶ added in v0.0.7
type Duration struct { Meta // contains filtered or unexported fields }
func (*Duration) FromString ¶ added in v0.0.7
type Float ¶ added in v0.0.6
type Float struct { Meta // contains filtered or unexported fields }
func (*Float) FromString ¶ added in v0.0.6
type Int ¶ added in v0.0.6
type Int struct { Meta // contains filtered or unexported fields }
func (*Int) FromString ¶ added in v0.0.6
type LevelPrinter ¶
type LevelPrinter struct { Ln Println // F prints like fmt.Println surrounded by log details F Printf // S uses spew.dump to show the content of a variable S Prints // C accepts a function so that the extra computation can be avoided if // it is not being viewed C Printc // Chk is a shortcut for printing if there is an error, or returning // true Chk Chk }
LevelPrinter defines a set of terminal printing primitives that output with extra data, time, level, and code location
type List ¶ added in v0.0.6
func (*List) FromString ¶ added in v0.0.6
FromString converts a comma separated list of strings into a List
type Logger ¶
type Logger struct {
F, E, W, I, D, T LevelPrinter
}
type Meta ¶ added in v0.0.6
type Meta struct {
// contains filtered or unexported fields
}
Meta automatically implements everything except the inputs and outputs
func NewMeta ¶ added in v0.0.6
NewMeta allows you to create a Meta with a sparsely filled, named field struct literal
func (*Meta) Description ¶ added in v0.0.6
func (*Meta) Documentation ¶ added in v0.0.6
type Printc ¶
type Printc func(closure func() string)
Printc accepts a function so that the extra computation can be avoided if it is not being viewed
type Printf ¶
type Printf func(format string, a ...interface{})
Printf prints like fmt.Println surrounded by log details
type Println ¶
type Println func(a ...interface{})
Println prints lists of interfaces with spaces in between
type String ¶ added in v0.0.6
type String struct { Meta // contains filtered or unexported fields }
func (*String) FromString ¶ added in v0.0.6
type Uint ¶ added in v0.0.6
type Uint struct { Meta // contains filtered or unexported fields }