logging

package
v0.0.0-...-813070f Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug string = "DEBUG"
	Info  string = "INFO"
	Alert string = "ALERT"
	Error string = "ERROR"
	Fatal string = "FATAL"
)

constants for logging levels

Variables

View Source
var Levels = []string{Debug, Info, Alert, Error, Fatal}

Levels defining a list of levels

Functions

func Init

func Init(cfg Config)

Init initialise the service logger

Types

type Config

type Config struct {
	Level    string `yaml:"level"`
	Filename string `yaml:"filename"`

	Gelfurl  string `yaml:"gelf-url"`
	Gelfport int    `yaml:"gelf-port"`
}

Config configuration for the gelf logging

type Logger

type Logger struct {
	Level    string
	LevelInt int
	GelfURL  string
	GelfPort int
	SystemID string
	Attrs    map[string]any
	Filename string
	// contains filtered or unexported fields
}

Logger main type for logging

var Root Logger

Root to use for all logging

func New

func New() *Logger

New creating a new logger instance

func (*Logger) Alert

func (s *Logger) Alert(m string)

Alert log this message at alert level

func (*Logger) Alertf

func (s *Logger) Alertf(format string, va ...any)

Alertf log this message at alert level with formatting.

func (*Logger) Close

func (s *Logger) Close()

Close this logging client

func (*Logger) Debug

func (s *Logger) Debug(m string)

Debug log this message at debug level

func (*Logger) Debugf

func (s *Logger) Debugf(format string, va ...any)

Debugf log this message at debug level with formatting

func (*Logger) Error

func (s *Logger) Error(m string)

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

func (*Logger) Errorf

func (s *Logger) Errorf(format string, va ...any)

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

func (*Logger) Fatal

func (s *Logger) Fatal(m string)

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

func (*Logger) Fatalf

func (s *Logger) Fatalf(format string, va ...any)

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

func (*Logger) Info

func (s *Logger) Info(m string)

Info log this message at info level

func (*Logger) Infof

func (s *Logger) Infof(format string, va ...any)

Infof log this message at info level with formatting

func (*Logger) Init

func (s *Logger) Init()

Init initialise logging

func (*Logger) IsAlert

func (s *Logger) IsAlert() bool

IsAlert this logger is set to debug or info level

func (*Logger) IsDebug

func (s *Logger) IsDebug() bool

IsDebug this logger is set to debug level

func (*Logger) IsError

func (s *Logger) IsError() bool

IsError this logger is set to debug or info level

func (*Logger) IsFatal

func (s *Logger) IsFatal() bool

IsFatal this logger is set to debug or info level

func (*Logger) IsInfo

func (s *Logger) IsInfo() bool

IsInfo this logger is set to debug or info level

func (*Logger) SetLevel

func (s *Logger) SetLevel(level string)

SetLevel setting the level of this logger

func (*Logger) SetName

func (s *Logger) SetName(name string)

SetName setting the logger name

func (*Logger) WithLevel

func (s *Logger) WithLevel(level string) *Logger

WithLevel setting the level of the logger

func (*Logger) WithName

func (s *Logger) WithName(name string) *Logger

WithName setting the logger name

Jump to

Keyboard shortcuts

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