gologging

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: LGPL-3.0 Imports: 18 Imported by: 2

README

GoLogging

A minimal and colorful CLI Go logging library.

It provides a leveled structured human-readable logger with a small API. Unlike standard log, the gollogging library provides a leveled logger with a structured output.
  • Uses Lip Gloss to style and colorize the output.
  • Colorful, human readable format.
  • Supports structured logging.
  • Supports lambda for caller frame.
  • Supports leveled logging.
  • Android Studio Logcat like output.

Supports Also Lambda Functions

Documentation

Index

Constants

View Source
const MinTermWidth = 200

Variables

This section is empty.

Functions

func Debug

func Debug(message ...any)

func Error

func Error(message ...any)

func Fatal

func Fatal(message ...any)

func Info

func Info(message ...any)

func SetLevel

func SetLevel(level Level)

func SetOutput added in v1.0.6

func SetOutput(w io.Writer)

func Warn

func Warn(message ...any)

Types

type Level

type Level int32
const (
	// DebugLevel is the debug level.
	DebugLevel Level = 1 << iota
	// InfoLevel is the info level.
	InfoLevel
	// WarnLevel is the warn level.
	WarnLevel
	// ErrorLevel is the error level.
	ErrorLevel
	// FatalLevel is the fatal level.
	FatalLevel
)

func GetLevel added in v1.0.6

func GetLevel() Level

type Logger added in v1.0.6

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

func GetLogger added in v1.0.6

func GetLogger(name string) *Logger

func (*Logger) Debug added in v1.0.6

func (ctx *Logger) Debug(message ...any)

func (*Logger) Error added in v1.0.6

func (ctx *Logger) Error(message ...any)

func (*Logger) Fatal added in v1.0.6

func (ctx *Logger) Fatal(message ...any)

func (*Logger) GetLevel added in v1.0.6

func (ctx *Logger) GetLevel() Level

func (*Logger) Info added in v1.0.6

func (ctx *Logger) Info(message ...any)

func (*Logger) SetLevel added in v1.0.6

func (ctx *Logger) SetLevel(level Level)

func (*Logger) SetOutput added in v1.0.6

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

func (*Logger) Warn added in v1.0.6

func (ctx *Logger) Warn(message ...any)

type Styles added in v1.0.6

type Styles struct {
	TimeStyle  lipgloss.Style
	TagStyle   lipgloss.Style
	PkgStyle   lipgloss.Style
	MsgStyle   lipgloss.Style
	BlockStyle lipgloss.Style
	FileStyle  lipgloss.Style
	IconStyle  lipgloss.Style
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳