slogger

package module
v0.0.0-...-076379b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: GPL-3.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	LstdFlags     int = real_log.LstdFlags
	Lmicroseconds int = real_log.Lmicroseconds
)
View Source
const (
	TIMEFORMAT_SECONDS_WITH_TZ = "2006-01-02 15:04:05 MST"
)

Variables

View Source
var ExitProfiling bool
View Source
var SysBaseLogPath string = "/data/logs"

Functions

func DeferCloseBodyErr

func DeferCloseBodyErr(Body io.ReadCloser, label string)

func Exit

func Exit(code int)

func LineInfo

func LineInfo(calldepth int, format string) string

func LogLevelString

func LogLevelString(Level LogLevel) string

func MyExecBaseName

func MyExecBaseName() string

func SetProfile

func SetProfile(label string, bob interface{})

func TimeWithTz

func TimeWithTz(Time time.Time) string

Types

type LogEntry

type LogEntry struct {
	Time  time.Time
	Text  string
	Level LogLevel
}

type LogLevel

type LogLevel int
const (
	SPAM   LogLevel = -30
	SECRET LogLevel = -20
	DEBUG  LogLevel = -10
	INFO   LogLevel = 0
	WARN   LogLevel = 10
	ERROR  LogLevel = 20
	CRIT   LogLevel = 30
	ELE    LogLevel = 100
)

type Logger

type Logger struct {
	MinLevel       LogLevel
	MinBufferLevel LogLevel
	TraceAbove     LogLevel
	LineAbove      LogLevel
	LogBase        string

	RealLogger      *real_log.Logger
	BufferLineLimit int
	BufferSizeLimit int
	Buffer          []LogEntry

	LinenumFormat string
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger() *Logger

func SetLogger

func SetLogger(l *Logger) *Logger

func (*Logger) AddLogEntry

func (l *Logger) AddLogEntry(Entry LogEntry) *Logger

func (*Logger) BufferAsHtml

func (l *Logger) BufferAsHtml() string

func (*Logger) Coref

func (l *Logger) Coref(Level LogLevel, format string, options ...interface{}) bool

func (*Logger) Critf

func (l *Logger) Critf(format string, options ...interface{}) bool

func (*Logger) Debugf

func (l *Logger) Debugf(format string, options ...interface{}) bool

func (*Logger) DepthOffsetAbs

func (l *Logger) DepthOffsetAbs(i int)

func (*Logger) DepthOffsetRel

func (l *Logger) DepthOffsetRel(i int)

func (*Logger) ErrErrf

func (l *Logger) ErrErrf(format string, options ...interface{}) error

Little play on words. It's a logged errorf() that returns an error so you can return it AS an error

func (*Logger) ErrorIff

func (l *Logger) ErrorIff(err error, format string, options ...interface{}) bool

func (*Logger) Errorf

func (l *Logger) Errorf(format string, options ...interface{}) bool

func (*Logger) FatalIff

func (l *Logger) FatalIff(err error, format string, options ...interface{})

func (*Logger) FatalInfoIff

func (l *Logger) FatalInfoIff(err error, format string, options ...interface{})

func (*Logger) FatalTracef

func (l *Logger) FatalTracef(format string, options ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, options ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, options ...interface{}) bool

func (*Logger) Init

func (l *Logger) Init() error

func (*Logger) LogLevelFromString

func (l *Logger) LogLevelFromString(Level string) LogLevel

func (*Logger) LogName

func (l *Logger) LogName() string

func (*Logger) Panicf

func (l *Logger) Panicf(format string, options ...interface{})

func (*Logger) PrintIff

func (l *Logger) PrintIff(err error, format string, options ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, options ...interface{})

func (*Logger) RelayServer

func (l *Logger) RelayServer(c net.Conn)

func (*Logger) Secretf

func (l *Logger) Secretf(format string, options ...interface{}) bool

func (*Logger) ServeLogSocket

func (l *Logger) ServeLogSocket(Path string)

func (*Logger) SetBaseName

func (l *Logger) SetBaseName(Base string)

func (*Logger) SetBufferLines

func (l *Logger) SetBufferLines(x int) *Logger

func (*Logger) SetBufferSize

func (l *Logger) SetBufferSize(x int) *Logger

func (*Logger) SetFlags

func (l *Logger) SetFlags(Flags int) *Logger

func (*Logger) SetLineAbove

func (l *Logger) SetLineAbove(Level LogLevel) *Logger

func (*Logger) SetLineFormat

func (l *Logger) SetLineFormat(format string) *Logger

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer) *Logger

func (*Logger) SetThreshold

func (l *Logger) SetThreshold(Level LogLevel) *Logger

func (*Logger) SetTraceAbove

func (l *Logger) SetTraceAbove(Level LogLevel) *Logger

func (*Logger) Warnf

func (l *Logger) Warnf(format string, options ...interface{}) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL