jlog

package
v0.0.0-...-6f5c55b Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelOrder []LogLevel = []LogLevel{
	DEFAULT,
	DEBUG,
	TRACE,
}

Order of log level. If log level is >= the current log level it will be outputted. e.g. - If current log level set to trace, a message marked as default WILL be outputted - If current log level set to default, a message marked as trace WILL NOT be outputted

Functions

func Debug

func Debug(message string)

func Debugf

func Debugf(message string, a ...interface{})

func Log

func Log(a ...interface{})

func LogStack

func LogStack()

func Logf

func Logf(message string, a ...interface{})

func SetLogLevel

func SetLogLevel(level LogLevel)

func SetLogWriter

func SetLogWriter(writer io.Writer)

func SetProcess

func SetProcess(process string)

func ShouldLog

func ShouldLog(messageLogLevel LogLevel, writerLogLevel LogLevel) bool

Types

type LogLevel

type LogLevel string
const (
	DEBUG   LogLevel = "debug"
	DEFAULT LogLevel = "default"
	TRACE   LogLevel = "trace"
	ERROR   LogLevel = "error"
)

type LogLine

type LogLine struct {
	Level   LogLevel
	Message string
	Time    time.Time
}

type LogWriter

type LogWriter struct {
	Writer io.Writer
	Levels []LogLevel
}

type Logger

type Logger struct {
	LogLines []LogLine
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger(writer io.Writer, levels []LogLevel) *Logger

func (*Logger) AddLogWriter

func (l *Logger) AddLogWriter(writer LogWriter) *Logger

func (*Logger) Debug

func (l *Logger) Debug(message string, a ...interface{})

func (*Logger) Log

func (l *Logger) Log(message string, a ...interface{})

func (*Logger) SetDebugLogLevel

func (l *Logger) SetDebugLogLevel() *Logger

func (*Logger) SetDefaultLogLevel

func (l *Logger) SetDefaultLogLevel() *Logger

func (*Logger) SetLogWriter

func (l *Logger) SetLogWriter(writer LogWriter) *Logger

func (*Logger) SetTraceLogLevel

func (l *Logger) SetTraceLogLevel() *Logger

func (*Logger) Trace

func (l *Logger) Trace(message string, a ...interface{})

Jump to

Keyboard shortcuts

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