logger

package
v2.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 12 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

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

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

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

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

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

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(mr bool, logFile string, customLogsDir string)

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

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

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

Types

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