logger

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProgrammeName           string = "gcsfuse"
	GCSFuseInBackgroundMode string = "GCSFUSE_IN_BACKGROUND_MODE"
)

Syslog file contains logs from all different programmes running on the VM. ProgrammeName is prefixed to all the logs written to syslog. This constant is used to filter the logs from syslog and write it to respective log files - gcsfuse.log in case of GCSFuse.

View Source
const (
	// LevelTrace value is set to -8, so that all the other log levels are logged.
	LevelTrace = slog.Level(-8)
	LevelDebug = slog.LevelDebug
	LevelInfo  = slog.LevelInfo
	LevelWarn  = slog.LevelWarn
	LevelError = slog.LevelError
	// LevelOff value is set to 12, so that nothing is logged.
	LevelOff = slog.Level(12)
)

Variables

This section is empty.

Functions

func Close

func Close()

Close closes the log file when necessary.

func Debugf

func Debugf(format string, v ...interface{})

Debugf prints the message with DEBUG severity in the specified format.

func Errorf

func Errorf(format string, v ...interface{})

Errorf prints the message with ERROR severity in the specified format.

func Fatal

func Fatal(format string, v ...interface{})

Fatal prints an error log and exits with non-zero exit code.

func Info

func Info(v ...interface{})

Info prints the message with info severity.

func Infof

func Infof(format string, v ...interface{})

Infof prints the message with INFO severity in the specified format.

func InitLogFile

func InitLogFile(logConfig config.LogConfig) error

InitLogFile initializes the logger factory to create loggers that print to a log file. In case of empty file, it starts writing the log to syslog file, which is eventually filtered and redirected to a fixed location using syslog config. Here, background true means, this InitLogFile has been called for the background daemon.

func NewLegacyLogger

func NewLegacyLogger(level slog.Level, prefix string) *log.Logger

NewLegacyLogger creates a new legacy logger. Avoid using this logger wherever possible and prioritise using the default logger methods like Infof(), Warnf(), Errorf(), etc present in logger package as this does not provide control to set log level for individual log messages. This method is created to support jacobsa/fuse loggers and will be removed after slog support is added.

func SetLogFormat

func SetLogFormat(format string)

SetLogFormat updates the log format of default logger.

func Tracef

func Tracef(format string, v ...interface{})

Tracef prints the message with TRACE severity in the specified format.

func Warnf

func Warnf(format string, v ...interface{})

Warnf prints the message with WARNING severity in the specified format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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