logger

package
v1.0.66 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleID = "LOG"
)

Variables

View Source
var ActiveLogFile string

ActiveLogFile log file represents the file which will be used for the backend logging

Functions

func Debug

func Debug(msg string)

Debug logs DEBUG messages. stdout flag indicates if message is to be written to stdout in addition to log.

func DebugLog

func DebugLog(ctx context.Context, module string, msg string)

func Debugf added in v1.0.62

func Debugf(msg string, args ...interface{})

Debugf logs DEBUG messages. stdout flag indicates if message is to be written to stdout in addition to log.

func DebugfLog

func DebugfLog(ctx context.Context, module string, msg string, args ...interface{})

func Error

func Error(msg string)

Error logs ERROR messages. stdout flag indicates if message is to be written to stdout in addition to log.

func ErrorLog

func ErrorLog(ctx context.Context, module string, msg string)

func Errorf added in v1.0.62

func Errorf(msg string, args ...interface{})

Errorf logs ERROR messages. stdout flag indicates if message is to be written to stdout in addition to log.

func ErrorfLog

func ErrorfLog(ctx context.Context, module string, msg string, args ...interface{})

func Fatal added in v1.0.62

func Fatal(msg string)

Fatal logs CRITICAL messages and exits. stdout flag indicates if message is to be written to stdout in addition to log.

func FatalLog

func FatalLog(ctx context.Context, module string, msg string)

func Fatalf added in v1.0.62

func Fatalf(msg string, args ...interface{})

Fatalf logs CRITICAL messages and exits. stdout flag indicates if message is to be written to stdout in addition to log.

func FatalfLog

func FatalfLog(ctx context.Context, module string, msg string, args ...interface{})

func HandleWarningMessages added in v1.0.62

func HandleWarningMessages(warnings []string)

HandleWarningMessages logs multiple messages in WARNING mode

func HandleWarningMessagesLog

func HandleWarningMessagesLog(ctx context.Context, module string, warnings []string)

func Info

func Info(msg string)

Info logs INFO messages. stdout flag indicates if message is to be written to stdout in addition to log.

func InfoLog

func InfoLog(ctx context.Context, module string, msg string)

func Infof added in v1.0.62

func Infof(msg string, args ...interface{})

Infof logs INFO messages. stdout flag indicates if message is to be written to stdout in addition to log.

func InfofLog

func InfofLog(ctx context.Context, module string, msg string, args ...interface{})

func Initialize

func Initialize(config Config)

Initialize logger with given level

func Warning

func Warning(msg string)

Warning logs WARNING messages. stdout flag indicates if message is to be written to stdout in addition to log.

func WarningLog

func WarningLog(ctx context.Context, module string, msg string)

func Warningf added in v1.0.62

func Warningf(msg string, args ...interface{})

Warningf logs WARNING messages. stdout flag indicates if message is to be written to stdout in addition to log.

func WarningfLog

func WarningfLog(ctx context.Context, module string, msg string, args ...interface{})

func WithOperationID added in v1.0.62

func WithOperationID(ctx context.Context, msg string) string

Types

type Config added in v1.0.62

type Config struct {
	MachineReadable bool
	Dir             string
	Filename        string
	MaxSize         int
	MaxBackups      int
	MaxAge          int
	Compress        bool
}

type LogInfo

type LogInfo struct {
	LogLevel string `json:"logLevel"`
	Message  string `json:"message"`
}

LogInfo represents the log message structure for plugins

type LogWriter

type LogWriter struct {
	Stderr io.Writer
	Stdout io.Writer
}

LogWriter represents the type which consists of two custom writers

func NewLogWriter

func NewLogWriter(LoggerID string, stdout bool, stream int) *LogWriter

NewLogWriter creates a new logWriter for given id

type OutMessage

type OutMessage struct {
	MessageType string `json:"type"`
	Message     string `json:"message"`
}

OutMessage contains information for output log

func (*OutMessage) ToJSON

func (out *OutMessage) ToJSON() (string, error)

ToJSON converts OutMessage into JSON

type Writer

type Writer struct {
	LoggerID            string
	ShouldWriteToStdout bool

	File io.Writer
	// contains filtered or unexported fields
}

Writer represents to a custom writer. It intercepts the log messages and redirects them to logger according the log level given in info

func (Writer) Write

func (w Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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