logger

package module
v0.0.0-...-edac00f Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 8 Imported by: 0

README

logger

A simple logger

Documentation

Index

Constants

View Source
const (
	LevelFatal   = slog.Level(12)
	LevelSuccess = slog.Level(2)
	LevelLog     = slog.Level(1)
)

Variables

View Source
var LevelNames = map[slog.Leveler]string{
	LevelFatal:   "FATAL",
	LevelSuccess: "SUCCESS",
	LevelLog:     "LOG",
}
View Source
var Verbose = 0

Functions

func Debug

func Debug(msg interface{}, args ...interface{})

func Error

func Error(msg interface{}, args ...interface{})

func Fatal

func Fatal(msg interface{}, args ...interface{})

func Info

func Info(msg interface{}, args ...interface{})

func Log

func Log(msg interface{}, args ...interface{})

func SetAppLogger

func SetAppLogger(l *Logger)

func Success

func Success(msg interface{}, args ...interface{})

Types

type Config

type Config struct {
	EnableColors bool
	Name         string
	Stdout       io.Writer
	Path         string
	PrefixColor  int
	OutputJSON   bool
	Level        slog.Level
	Handler      slog.Handler
	UseSprintf   bool
}

type Logger

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

func GetAppLogger

func GetAppLogger() *Logger

func NewLogger

func NewLogger(c *Config) *Logger

func NewLoggerByName

func NewLoggerByName(name string, colorCode int) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg interface{}, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(msg interface{}, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(msg interface{}, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(msg interface{}, args ...interface{})

func (*Logger) Log

func (l *Logger) Log(msg interface{}, args ...interface{})

func (*Logger) Success

func (l *Logger) Success(msg interface{}, args ...interface{})

Jump to

Keyboard shortcuts

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