logger

package
v0.6.33 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDetails added in v0.6.21

func FormatDetails(details []string) string

FormatDetails gets the formatted details

func FormatErrors added in v0.6.21

func FormatErrors(errors []error) string

FormatErrors gets the formatted errors

func FormatStatus added in v0.6.21

func FormatStatus(status Status) string

FormatStatus gets the formatted status

Types

type DefaultLogger

type DefaultLogger struct {
	Name          string
	FormattedName string
}

DefaultLogger is a logger that logs messages

func NewDefaultLogger

func NewDefaultLogger(name string) DefaultLogger

NewDefaultLogger creates a new logger

func (DefaultLogger) FormatLogError added in v0.6.21

func (d DefaultLogger) FormatLogError(logError *LogError) string

FormatLogError formats a log error

func (DefaultLogger) FormatLogMessage added in v0.6.21

func (d DefaultLogger) FormatLogMessage(logMessage *LogMessage) string

FormatLogMessage formats a log message

func (DefaultLogger) LogError added in v0.6.21

func (d DefaultLogger) LogError(logError *LogError)

LogError logs an error

func (DefaultLogger) LogMessage

func (d DefaultLogger) LogMessage(logMessage *LogMessage)

LogMessage logs a message

type Log added in v0.6.21

type Log interface {
	String() string
}

Log interface

type LogError added in v0.6.21

type LogError struct {
	Title  string
	Errors []error
}

LogError struct

func NewLogError added in v0.6.21

func NewLogError(title string, errors ...error) *LogError

NewLogError creates a new log error

func (*LogError) String added in v0.6.21

func (l *LogError) String() string

String gets the string representation of a log error

type LogMessage added in v0.6.21

type LogMessage struct {
	Title   string
	Details []string
	Status  Status
}

LogMessage struct

func NewLogMessage added in v0.6.21

func NewLogMessage(title string, status Status, details ...string) *LogMessage

NewLogMessage creates a new log message

func (*LogMessage) String added in v0.6.21

func (l *LogMessage) String() string

String gets the string representation of a log message

type Logger

type Logger interface {
	LogMessage(logMessage *LogMessage)
	LogError(logError *LogError)
}

Logger is an interface for logging messages

type Status added in v0.6.4

type Status int

Status is the status of the logger

const (
	StatusSuccess Status = iota
	StatusFailed
	StatusError
	StatusWarning
	StatusInfo
	StatusDebug
	StatusTrace
	StatusNone
	StatusUnknown
)

func (Status) String added in v0.6.4

func (s Status) String() string

String returns the string representation of the status

Jump to

Keyboard shortcuts

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