logutils

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

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 0 Imported by: 4

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