logutils

package module
v0.0.0-...-0569e5b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: MIT Imports: 0 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

logutils

Documentation

Index

Constants

View Source
const (
	// NOTIFICATION / SUMMARY
	EmojiPanic   = "❌"  // 2 X
	EmojiError   = "❌"  // 3 R
	EmojiWarning = "🟨"  // 4 Y
	EmojOkay     = "🟩"  // 5 G
	EmojiInfo    = "ℹ️" // 6 I
	// TRANSIENT
	// EmojiProgress = "▫️" // 7
	// EmojiDbg = "❓"  // misspelled cos 8 != RFC5424 "7"
	EmojiDebug = "💠"
)

Levels (3,4,5) (Error,Warning,Okay) (3,4,5) (R,Y,G) are intended as summary items for execution checkpoints. Grn, Ylw, Red (currently disabled) are calm B/G indicator lights. .

Variables

View Source
var LevelNames = map[Level]string{
	LevelDebug: "?Dbg",

	LevelInfo:    "Info",
	LevelOkay:    "Okay",
	LevelWarning: "Warning",
	LevelError:   "Error",
	LevelPanic:   "PANIC",
}

LevelNames maps log levels to user-frenly names

Functions

func EmojiOfLevel

func EmojiOfLevel(L Level) string

Types

type Level

type Level int

Level describes the level of a log message.

const (
	LevelPanic   Level = iota + 2 // i.e. 0 + 2
	LevelError                    // 3 // red light
	LevelWarning                  // 4 // yellow light
	LevelOkay                     // 5 // green light
	LevelInfo                     // 6
	// LevelProgress    // 7
	LevelDebug // 7
	//
	// Utility levels for fancier console output
	GreenBG
)

RFC5424 log message levels.

func (Level) String

func (l Level) String() string

String returns the string representation of the log level

type LogMessage

type LogMessage struct {
	Level
	// contains filtered or unexported fields
}

LogMessage is a log level + string message pair. It should be accumulated into a slice by code that does not have access to system logging facilities.

The string can be (for example) the output of a call to fmt.Sprintf(..) that would normally be passed to a logger. It could therefore be created using the "%w" format specifier. .

type LogMsgList

type LogMsgList []LogMessage

func (LogMsgList) MaxLevel

func (llm LogMsgList) MaxLevel(maxLvl Level)

Jump to

Keyboard shortcuts

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