logger

package
v1.0.51 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActiveLogFile string

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

Functions

func Critical

func Critical(logger *logging.Logger, msg string)

func Debug

func Debug(logger *logging.Logger, stdout bool, msg string)

func DebugLog

func DebugLog(module string, stdout bool, msg string)

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

func DebugfLog

func DebugfLog(module string, stdout bool, msg string, args ...interface{})

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

func Error

func Error(logger *logging.Logger, stdout bool, msg string)

func ErrorLog

func ErrorLog(module string, stdout bool, msg string)

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

func ErrorfLog

func ErrorfLog(module string, stdout bool, msg string, args ...interface{})

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

func FatalLog

func FatalLog(module string, stdout bool, msg string)

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

func FatalfLog

func FatalfLog(module string, stdout bool, msg string, args ...interface{})

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

func HandleWarningMessagesLog

func HandleWarningMessagesLog(module string, stdout bool, warnings []string)

HandleWarningMessagesLog logs multiple messages in WARNING mode

func Info

func Info(logger *logging.Logger, stdout bool, msg string)

func InfoLog

func InfoLog(module string, stdout bool, msg string)

func InfofLog

func InfofLog(module string, stdout bool, msg string, args ...interface{})

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

func Initialize

func Initialize(mr bool, logLevel logging.Level, fileName FileName, customLogsDir string)

Initialize logger with given level

func Warning

func Warning(logger *logging.Logger, stdout bool, msg string)

func WarningLog

func WarningLog(module string, stdout bool, msg string)

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

func WarningfLog

func WarningfLog(module string, stdout bool, msg string, args ...interface{})

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

Types

type CustomWriter

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

func NewCustomWriter

func NewCustomWriter(portChan chan string, outFile io.Writer, id string, isErrorStream bool) CustomWriter

func (CustomWriter) Write

func (w CustomWriter) Write(p []byte) (n int, err error)

type FileName

type FileName string
const (
	API FileName = "api.log"
)

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