logger

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 122

Documentation

Index

Constants

View Source
const (

	// CLI indicates gauge is used as a CLI.
	CLI = iota
	// API indicates gauge is in daemon mode. Used in IDEs.
	API
	// LSP indicates that gauge is acting as an LSP server.
	LSP
)

Variables

View Source
var ActiveLogFile string

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

Functions

func Debug added in v0.3.0

func Debug(stdout bool, msg string)

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

func Debugf added in v0.9.0

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

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

func Error added in v0.3.0

func Error(stdout bool, msg string)

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

func Errorf added in v0.3.2

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

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

func Fatal added in v0.3.0

func Fatal(stdout bool, msg string)

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

func Fatalf added in v0.3.2

func Fatalf(stdout bool, 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 HandleWarningMessages added in v0.1.7

func HandleWarningMessages(stdout bool, warnings []string)

HandleWarningMessages logs multiple messages in WARNING mode

func Info added in v0.3.0

func Info(stdout bool, msg string)

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

func Infof added in v0.9.0

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

Infof 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 string, c int)

Initialize logger with given level

func Warning added in v0.3.0

func Warning(stdout bool, msg string)

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

func Warningf added in v0.9.0

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

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

Types

type CustomWriter added in v1.0.9

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

func NewCustomWriter added in v1.0.7

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

func (CustomWriter) Write added in v1.0.9

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

type LogInfo added in v1.0.6

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

LogInfo represents the log message structure for plugins

type LogWriter added in v1.0.6

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

LogWriter represents the type which consists of two custom writers

func NewLogWriter added in v1.0.6

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

NewLogWriter creates a new logWriter for given id

type OutMessage added in v1.0.6

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

OutMessage contains information for output log

func (*OutMessage) ToJSON added in v1.0.6

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

ToJSON converts OutMessage into JSON

type Writer added in v1.0.6

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 added in v1.0.6

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