locker

package module
v0.0.0-...-1e118b5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

README

locker

A simplistic logging library for go.

Locker is meant to be very simple with little to no configuration. I was inspired by logbuch and decided I wanted to create my own little logging library.

I do not recommend using this for large scale or professional applications, as it may not be fast or configurable enough to suite your needs.

Documentation

Index

Constants

View Source
const (
	LevelDebug = iota
	LevelInfo
	LevelWarn
	LevelError
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string)

func Error

func Error(msg string)

func Info

func Info(msg string)

func Pop

func Pop()

func Push

func Push(context string)

func SetWriter

func SetWriter(logwriter LogWriter)

func Warn

func Warn(msg string)

Types

type CombinedWriter

type CombinedWriter struct {
	// contains filtered or unexported fields
}

func NewCombinedWriter

func NewCombinedWriter(loggers []LogWriter) CombinedWriter

func (CombinedWriter) GetLevel

func (c CombinedWriter) GetLevel() int

func (CombinedWriter) Write

func (c CombinedWriter) Write(msg string, level int)

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(level int, path string) FileWriter

func (FileWriter) GetLevel

func (f FileWriter) GetLevel() int

func (FileWriter) Write

func (f FileWriter) Write(msg string, level int)

type LogWriter

type LogWriter interface {
	Write(msg string, level int)
	GetLevel() int
}

func DefaultDebugWriter

func DefaultDebugWriter() LogWriter

func DefaultProdWriter

func DefaultProdWriter() LogWriter

type TerminalWriter

type TerminalWriter struct {
	// contains filtered or unexported fields
}

func NewTerminalWriter

func NewTerminalWriter(level int) TerminalWriter

func (TerminalWriter) GetLevel

func (t TerminalWriter) GetLevel() int

func (TerminalWriter) Write

func (t TerminalWriter) Write(msg string, level int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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