logging

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logging provides logging functionalities for Gofr applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level represents different logging levels.

const (
	DEBUG Level = iota + 1
	INFO
	NOTICE
	WARN
	ERROR
	FATAL
)

func GetLevelFromString

func GetLevelFromString(level string) Level

GetLevelFromString converts a string to a logging level.

func (Level) MarshalJSON

func (l Level) MarshalJSON() ([]byte, error)

func (Level) String

func (l Level) String() string

String returns the string representation of the log level.

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Notice(args ...interface{})
	Noticef(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	// contains filtered or unexported methods
}

Logger represents a logging interface.

func NewFileLogger added in v1.1.1

func NewFileLogger(path string) Logger

NewFileLogger creates a new logger instance with logging to a file.

func NewLogger

func NewLogger(level Level) Logger

NewLogger creates a new logger instance with the specified logging level.

func NewRemoteLogger added in v0.2.0

func NewRemoteLogger(level Level, remoteConfigURL, loggerFetchInterval string) Logger

NewRemoteLogger creates a new RemoteLogger instance with the provided level, remote configuration URL, and level fetch interval. The remote configuration URL is expected to be a JSON endpoint that returns the desired log level for the service. The level fetch interval determines how often the logger checks for updates to the remote configuration.

type PrettyPrint added in v1.4.0

type PrettyPrint interface {
	PrettyPrint(writer io.Writer)
}

Jump to

Keyboard shortcuts

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