log

package
v0.0.0-...-6670238 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const PipedOutputNotification = "Notice: Output is being piped. 'Result' logs will be formatted accordingly."

PipedOutputNotification is the standard message to notify about piped output.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug logs a message at level Debug on the standard logger.

func Debugf

func Debugf(format string, v ...interface{})

Debugf logs a message at level Debug on the standard logger.

func Error

func Error(v ...interface{})

Error logs a message at level Error on the standard logger.

func Errorf

func Errorf(format string, v ...interface{})

Errorf logs a message at level Error on the standard logger.

func Fatal

func Fatal(v interface{})

Fatal logs a message at level Fatal on the standard logger.

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf logs a message at level Fatal on the standard logger.

func Info

func Info(v ...interface{})

Info logs a message at level Info on the standard logger.

func Infof

func Infof(format string, v ...interface{})

Infof logs a message at level Info on the standard logger.

func Init

func Init(name string)

Init initializes the global logger

func IsOutputPiped

func IsOutputPiped() bool

func Notify

func Notify(v ...interface{})

Notify prints a notification message to stderr if the output is being piped. It accepts an optional logger and defaults to the global logger if none is provided.

func Result

func Result(v ...interface{})

Result logs a message using a specified or global logger. The log is printed to stdout, and metadata is printed to stderr if not piped.

func Resultf

func Resultf(format string, v ...interface{})

Resultf logs a formatted message using a specified or global logger. The log is printed to stdout, and metadata is printed to stderr if not piped.

func SetLevel

func SetLevel(level Level)

SetLevel sets the logger level

func SetLevelStr

func SetLevelStr(level string)

SetLevelStr sets the logger level with a string

func Warn

func Warn(v ...interface{})

Warn logs a message at level Warn on the standard logger.

func Warnf

func Warnf(format string, v ...interface{})

Warnf logs a message at level Warn on the standard logger.

func WithFields

func WithFields(fields Fields) *logrus.Entry

WithFields returns a logrus entry with the fields set

Types

type CustomFormatter

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

func (*CustomFormatter) Format

func (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log output

type Fields

type Fields logrus.Fields

type Label

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

func NewLabel

func NewLabel(label string) *Label

NewLabel creates a new label

func (*Label) Log

func (l *Label) Log(v ...interface{})

Logf logs message at the Info level using the label's logger. If the label's logger is not set, it defaults to the global logger.

func (*Label) Logf

func (l *Label) Logf(format string, v ...interface{})

Logf logs a formatted message at the Info level using the label's logger. If the label's logger is not set, it defaults to the global logger.

func (*Label) SetColor

func (l *Label) SetColor(color string)

SetColor sets the label color

type Level

type Level int
const (
	DebugLevel Level = iota
	TraceLevel       // Custom level
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
	PanicLevel
)

func GetLevel

func GetLevel() Level

GetLevel returns the logger level

func (Level) String

func (lvl Level) String() string

String returns the string representation of the log level

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(packageName string) *Logger

NewLogger creates a new logger

func (*Logger) NewLabel

func (l *Logger) NewLabel(label string) *Label

NewLabel creates a new label

Jump to

Keyboard shortcuts

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