Documentation
¶
Index ¶
- Constants
- Variables
- func HTTPLogSettings(w http.ResponseWriter, r *http.Request, log *Level)
- func SanitizeString(s string) string
- type Level
- func (l Level) GetAtomicLevel() zap.AtomicLevel
- func (l Level) Level() zapcore.Level
- func (l *Level) MarshalText() ([]byte, error)
- func (l Level) MarshalYAML() (any, error)
- func (l *Level) Set(s string) error
- func (l Level) String() string
- func (l *Level) Type() string
- func (l *Level) UnmarshalText(text []byte) error
- type Logger
- type LoggerOption
- type StructuredLogger
- type ZapLogger
- func (l *ZapLogger) Debug(msg string, fields ...zap.Field)
- func (l *ZapLogger) Error(msg string, fields ...zap.Field)
- func (l *ZapLogger) Errorf(msg string, args ...any)
- func (l *ZapLogger) Fatalf(msg string, args ...any)
- func (l *ZapLogger) Info(msg string, fields ...zap.Field)
- func (l *ZapLogger) Infof(msg string, args ...any)
- func (l *ZapLogger) IsTraceEnabled() bool
- func (l *ZapLogger) Name() string
- func (l *ZapLogger) Named(name string) *ZapLogger
- func (l *ZapLogger) Trace(msg string, fields ...zap.Field)
- func (l *ZapLogger) Warn(msg string, fields ...zap.Field)
- func (l *ZapLogger) WithOptions(opts ...zap.Option) *ZapLogger
Constants ¶
View Source
const ( TRACE zapcore.Level = iota - 2 DEBUG INFO WARN ERROR )
Variables ¶
Functions ¶
func HTTPLogSettings ¶
func HTTPLogSettings(w http.ResponseWriter, r *http.Request, log *Level)
HTTPLogSettings is an HTTP handler that allows changing the log level of the logger. It can also be used to query what's the current log level.
func SanitizeString ¶
SanitizeString sanitises a string by removing characters that could compromise log integrity or be used for log injection. Also useful to avoid CodeQL CI errors like this: https://github.com/NethermindEth/juno/security/code-scanning/662
Types ¶
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
func (Level) GetAtomicLevel ¶
func (l Level) GetAtomicLevel() zap.AtomicLevel
func (*Level) MarshalText ¶
func (Level) MarshalYAML ¶
func (*Level) UnmarshalText ¶
type Logger ¶
type Logger interface {
pebble.Logger
StructuredLogger
}
type LoggerOption ¶
type LoggerOption func(*loggerConfig)
func WithColour ¶
func WithColour(colour bool) LoggerOption
func WithJSON ¶
func WithJSON(json bool) LoggerOption
func WithWriter ¶
func WithWriter(w io.Writer) LoggerOption
note(rdr): functionality wise so far this is only used for testing purposes
type StructuredLogger ¶
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
func NewNopZapLogger ¶
func NewNopZapLogger() *ZapLogger
func NewZapLogger ¶
func NewZapLogger(logLevel *Level, opts ...LoggerOption) (*ZapLogger, error)
func NewZapLoggerWithCore ¶
func (*ZapLogger) IsTraceEnabled ¶
Click to show internal directories.
Click to hide internal directories.