logger

package
v0.0.0-...-04d6450 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package logger holds the mostly used logger instance `GlobalLogger`

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Debugf

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

Debugf wraps Debugf of sugared logger, it uses fmt.Sprintf to log a templated message.

func Error

func Error(msg string, fields ...zap.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Errorf

func Errorf(template string, args ...interface{})

Errorf wraps Errorf of sugared logger, it uses fmt.Sprintf to log a templated message.

func Fatal

func Fatal(msg string, fields ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func Fatalf

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

Fatalf wraps Fatalf of sugared logger, it uses fmt.Sprintf to log a templated message. Other behaviors are similar to Fatal.

func Info

func Info(msg string, fields ...zap.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Infof

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

Infof wraps Infof of sugared logger, it uses fmt.Sprintf to log a templated message.

func Panic

func Panic(msg string, fields ...zap.Field)

Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then panics, even if logging at PanicLevel is disabled.

func Panicf

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

Panicf wraps Panicf of sugared logger, it uses fmt.Sprintf to log a templated message. Other behaviors are similar to Panic.

func SetLogger

func SetLogger(instance *zap.Logger)

SetLogger inject a logger instance. It is not strictly thread-safe. So there may still have logs output to the old logger within a short time.

func Sync

func Sync() error

Sync calls the underlying Core's Sync method, flushing any buffered log entries. Applications should take care to call Sync before exiting.

func Warn

func Warn(msg string, fields ...zap.Field)

Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Warnf

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

Warnf wraps Warnf of sugared logger, it uses fmt.Sprintf to log a templated message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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