logging

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 9 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{})
	ChangeLevel(level Level)
}

Logger represents a logging interface.

func NewFileLogger

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 NewMockLogger

func NewMockLogger(level Level) Logger

type MockLogger

type MockLogger struct {
	// contains filtered or unexported fields
}

func (*MockLogger) ChangeLevel

func (m *MockLogger) ChangeLevel(level Level)

func (*MockLogger) Debug

func (m *MockLogger) Debug(args ...interface{})

func (*MockLogger) Debugf

func (m *MockLogger) Debugf(format string, args ...interface{})

func (*MockLogger) Error

func (m *MockLogger) Error(args ...interface{})

func (*MockLogger) Errorf

func (m *MockLogger) Errorf(format string, args ...interface{})

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(args ...interface{})

func (*MockLogger) Fatalf

func (m *MockLogger) Fatalf(format string, args ...interface{})

func (*MockLogger) Info

func (m *MockLogger) Info(args ...interface{})

func (*MockLogger) Infof

func (m *MockLogger) Infof(format string, args ...interface{})

func (*MockLogger) Log

func (m *MockLogger) Log(args ...interface{})

func (*MockLogger) Logf

func (m *MockLogger) Logf(format string, args ...interface{})

func (*MockLogger) Notice

func (m *MockLogger) Notice(args ...interface{})

func (*MockLogger) Noticef

func (m *MockLogger) Noticef(format string, args ...interface{})

func (*MockLogger) Warn

func (m *MockLogger) Warn(args ...interface{})

func (*MockLogger) Warnf

func (m *MockLogger) Warnf(format string, args ...interface{})

type PrettyPrint

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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