Documentation ¶
Index ¶
- Constants
- Variables
- func Caller(comment string, skip int) string
- func Composite(text, level string) (final string)
- func DirectionString(inbound bool) string
- func FileExists(filePath string) bool
- func PickNoun(n int, singular, plural string) string
- type CheckFunc
- type Entry
- type LogWriter
- type Logger
- func (l *Logger) AddLogChan() (ch chan Entry)
- func (l *Logger) GetLoc(loc string, line int) (out string)
- func (l *Logger) LevelIsActive(level string) (out bool)
- func (l *Logger) LoadConfig(configFile []byte)
- func (l *Logger) LocToPkg(pkg string) (out string)
- func (l *Logger) Register(pkg string) string
- func (l *Logger) SetLevel(level string, color bool, split string)
- func (l *Logger) SetLogPaths(logPath, logFileName string)
- type PrintcFunc
- type PrintfFunc
- type PrintlnFunc
- type SpewFunc
Constants ¶
View Source
const ( Off = "off" Fatal = "fatal" Error = "error" Warn = "warn" Info = "info" Check = "check" Debug = "debug" Trace = "trace" )
Variables ¶
View Source
var ( Levels = []string{ Off, Fatal, Error, Check, Warn, Info, Debug, Trace, } Tags = map[string]string{ Off: "", Fatal: "FTL", Error: "ERR", Check: "CHK", Warn: "WRN", Info: "INF", Debug: "DBG", Trace: "TRC", } LevelsMap = map[string]int{ Off: 0, Fatal: 1, Error: 2, Check: 3, Warn: 4, Info: 5, Debug: 6, Trace: 7, } StartupTime = time.Now() )
View Source
var L = NewLogger()
Functions ¶
func DirectionString ¶
DirectionString is a helper function that returns a string that represents the direction of a connection (inbound or outbound).
func FileExists ¶
Types ¶
type LogWriter ¶
type LogWriter struct { io.Writer Write uberatomic.Bool }
func (*LogWriter) SetLogWriter ¶
type Logger ¶
type Logger struct { Packages *Pk.Package Level *uberatomic.String Fatal PrintlnFunc Error PrintlnFunc Warn PrintlnFunc Info PrintlnFunc Check CheckFunc Debug PrintlnFunc Trace PrintlnFunc Fatalf PrintfFunc Errorf PrintfFunc Warnf PrintfFunc Infof PrintfFunc Debugf PrintfFunc Tracef PrintfFunc Fatalc PrintcFunc Errorc PrintcFunc Warnc PrintcFunc Infoc PrintcFunc Debugc PrintcFunc Tracec PrintcFunc Fatals SpewFunc Errors SpewFunc Warns SpewFunc Infos SpewFunc Debugs SpewFunc Traces SpewFunc LogFileHandle *os.File Writer LogWriter Color bool Split string LogChan chan Entry LogChanDisabled *uberatomic.Bool }
Logger is a struct containing all the functions with nice handy names
func (*Logger) AddLogChan ¶
AddLogChan adds a channel that log entries are sent to
func (*Logger) LevelIsActive ¶
func (*Logger) LoadConfig ¶
func (*Logger) SetLogPaths ¶
SetLogPaths sets a file path to write logs
type PrintcFunc ¶
type PrintfFunc ¶
type PrintlnFunc ¶
type PrintlnFunc func(pkg string, a ...interface{})
Directories ¶
Path | Synopsis |
---|---|
Package Entry is a message type for logi log entries
|
Package Entry is a message type for logi log entries |
Package Pkg is a message type for logi package filtering
|
Package Pkg is a message type for logi package filtering |
consume
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages
|
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages |
serve
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause
|
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause |
Click to show internal directories.
Click to hide internal directories.