log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package log provides logger for logging various output messages in different formats, including color-coded terminal output and JSON.Gofr logger supports different log levels such as INFO, ERROR, WARN, DEBUG, or FATAL.

Index

Constants

View Source
const (
	Fatal level = iota + 1
	Error
	Warn
	Info
	Debug
)
View Source
const GofrVersion = "1.0.0"
View Source
const LevelFetchInterval = 10 // In seconds

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Log(args ...interface{})
	Logf(format string, a ...interface{})
	Debug(args ...interface{})
	Debugf(format string, a ...interface{})
	Info(args ...interface{})
	Infof(format string, a ...interface{})
	Warn(args ...interface{})
	Warnf(format string, a ...interface{})
	Error(args ...interface{})
	Errorf(format string, a ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, a ...interface{})
	AddData(key string, value interface{})
}

Logger is an interface for level based logging

func NewCorrelationLogger

func NewCorrelationLogger(correlationID string) Logger

NewCorrelationLogger creates and returns a new logger instance with a specified correlation ID.

func NewLogger

func NewLogger() Logger

NewLogger creates and returns a new logger instance that implements the Logger interface.

func NewMockLogger

func NewMockLogger(output io.Writer) Logger

Jump to

Keyboard shortcuts

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