logging

package
v0.0.0-...-5643740 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const LogFormatDefault = LogFormatText

LogFormatDefault is the default logging format

View Source
const LogFormatJSON = "json"

LogFormatJSON the json logging format

View Source
const LogFormatText = "text"

LogFormatText the text logging format

Variables

This section is empty.

Functions

func Debug

func Debug(msg string)

Debug log message

func Debugf

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

Debugf log message

func Error

func Error(trace string, err error)

Error log message with fields

func Fatal

func Fatal(args ...interface{})

Fatal log message

func Fatalf

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

Fatalf log message

func GenerateUUID

func GenerateUUID() string

GenerateUUID is function to generate our own uuid if the google uuid throws error

func GetLogFormat

func GetLogFormat() string

GetLogFormat returns the configured logging format

func GetLogger

func GetLogger() *logrus.Logger

GetLogger returns an instance of our logger

func GetRequestID

func GetRequestID(requestIDParams *string) string

GetRequestID is function to generate uuid as request id if client doesn't pass X-REQUEST-ID request header

func Info

func Info(msg string)

Info log message

func Infof

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

Infof log message

func IsJSONLogFormat

func IsJSONLogFormat() bool

IsJSONLogFormat returns true if the logging format is JSON

func IsTextLogFormat

func IsTextLogFormat() bool

IsTextLogFormat returns true if the logging format is text

func Panic

func Panic(args ...interface{})

Panic log message

func Panicf

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

Panicf log message

func Printf

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

Printf ...

func Println

func Println(args ...interface{})

Println log message

func Trace

func Trace() (line string)

Trace returns the source code line and function name (of the calling function)

func Warn

func Warn(msg string)

Warn log message

func Warnf

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

Warnf log message

func WithError

func WithError(err error) *logrus.Entry

WithError logs a message with the specified error

func WithField

func WithField(key string, value interface{}) *logrus.Entry

WithField log message with field

func WithFields

func WithFields(fields logrus.Fields) *logrus.Entry

WithFields logs a message with fields

Types

type UTCFormatter

type UTCFormatter struct {
	log.Formatter
}

UTCFormatter structure for logging

func (UTCFormatter) Format

func (u UTCFormatter) Format(e *log.Entry) ([]byte, error)

Format handler for UTC time - usage: log.SetFormatter(UTCFormatter{&log.JSONFormatter{}})

Jump to

Keyboard shortcuts

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