Documentation ¶
Overview ¶
Package logging provides logging functionalities for GoFr applications.
Index ¶
- type Level
- type LogLevelResponder
- type Logger
- type MockLogger
- func (m *MockLogger) ChangeLevel(level Level)
- func (m *MockLogger) Debug(args ...any)
- func (m *MockLogger) Debugf(format string, args ...any)
- func (m *MockLogger) Error(args ...any)
- func (m *MockLogger) Errorf(format string, args ...any)
- func (m *MockLogger) Fatal(args ...any)
- func (m *MockLogger) Fatalf(format string, args ...any)
- func (m *MockLogger) Info(args ...any)
- func (m *MockLogger) Infof(format string, args ...any)
- func (m *MockLogger) Log(args ...any)
- func (m *MockLogger) Logf(format string, args ...any)
- func (m *MockLogger) Notice(args ...any)
- func (m *MockLogger) Noticef(format string, args ...any)
- func (m *MockLogger) Warn(args ...any)
- func (m *MockLogger) Warnf(format string, args ...any)
- type PrettyPrint
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.
func GetLevelFromString ¶
GetLevelFromString converts a string to a logging level.
func GetLogLevelForError ¶ added in v1.29.0
GetLogLevelForError returns the log level for the given error. If the error implements [logLevelResponder], its log level is returned. Otherwise, the default log level "error" is returned.
func (Level) MarshalJSON ¶
type LogLevelResponder ¶ added in v1.29.0
type LogLevelResponder interface {
LogLevel() Level
}
LogLevelResponder is an interface that provides a method to get the log level.
type Logger ¶
type Logger interface { Debug(args ...any) Debugf(format string, args ...any) Log(args ...any) Logf(format string, args ...any) Info(args ...any) Infof(format string, args ...any) Notice(args ...any) Noticef(format string, args ...any) Warn(args ...any) Warnf(format string, args ...any) Error(args ...any) Errorf(format string, args ...any) Fatal(args ...any) Fatalf(format string, args ...any) ChangeLevel(level Level) }
Logger represents a logging interface.
func NewFileLogger ¶ added in v1.1.1
NewFileLogger creates a new logger instance with logging to a file.
func NewMockLogger ¶ added in v1.6.0
type MockLogger ¶ added in v1.6.0
type MockLogger struct {
// contains filtered or unexported fields
}
func (*MockLogger) ChangeLevel ¶ added in v1.6.0
func (m *MockLogger) ChangeLevel(level Level)
func (*MockLogger) Debug ¶ added in v1.6.0
func (m *MockLogger) Debug(args ...any)
func (*MockLogger) Debugf ¶ added in v1.6.0
func (m *MockLogger) Debugf(format string, args ...any)
func (*MockLogger) Error ¶ added in v1.6.0
func (m *MockLogger) Error(args ...any)
func (*MockLogger) Errorf ¶ added in v1.6.0
func (m *MockLogger) Errorf(format string, args ...any)
func (*MockLogger) Fatal ¶ added in v1.6.0
func (m *MockLogger) Fatal(args ...any)
func (*MockLogger) Fatalf ¶ added in v1.6.0
func (m *MockLogger) Fatalf(format string, args ...any)
func (*MockLogger) Info ¶ added in v1.6.0
func (m *MockLogger) Info(args ...any)
func (*MockLogger) Infof ¶ added in v1.6.0
func (m *MockLogger) Infof(format string, args ...any)
func (*MockLogger) Log ¶ added in v1.6.0
func (m *MockLogger) Log(args ...any)
func (*MockLogger) Logf ¶ added in v1.6.0
func (m *MockLogger) Logf(format string, args ...any)
func (*MockLogger) Notice ¶ added in v1.6.0
func (m *MockLogger) Notice(args ...any)
func (*MockLogger) Noticef ¶ added in v1.6.0
func (m *MockLogger) Noticef(format string, args ...any)
func (*MockLogger) Warn ¶ added in v1.6.0
func (m *MockLogger) Warn(args ...any)
func (*MockLogger) Warnf ¶ added in v1.6.0
func (m *MockLogger) Warnf(format string, args ...any)
type PrettyPrint ¶ added in v1.4.0
Click to show internal directories.
Click to hide internal directories.