Documentation
¶
Index ¶
- Constants
- func CleanupTestWriter(file *os.File) error
- func CreateCLIUpstreamServerLogger(config *config.LogConfig, serverName string) (*zap.Logger, error)
- func CreateHTTPLogger(config *config.LogConfig) (*zap.Logger, error)
- func CreateTestWriter() (io.Writer, *os.File, error)
- func CreateUpstreamServerLogger(config *config.LogConfig, serverName string) (*zap.Logger, error)
- func DefaultLogConfig() *config.LogConfig
- func EnsureLogDir(logDir string) error
- func GetLogDir() (string, error)
- func GetLogFilePath(filename string) (string, error)
- func GetLogFilePathWithDir(logDir, filename string) (string, error)
- func ReadUpstreamServerLogTail(config *config.LogConfig, serverName string, lines int) ([]string, error)
- func SetupCommandLogger(serverCommand bool, logLevel string, logToFile bool, logDir string) (*zap.Logger, error)
- func SetupLogger(config *config.LogConfig) (*zap.Logger, error)
- type LogDirInfo
- type LoggerInfo
- type SecretSanitizer
- func (s *SecretSanitizer) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (s *SecretSanitizer) RegisterResolvedSecret(value string)
- func (s *SecretSanitizer) UnregisterResolvedSecret(value string)
- func (s *SecretSanitizer) With(fields []zapcore.Field) zapcore.Core
- func (s *SecretSanitizer) Write(entry zapcore.Entry, fields []zapcore.Field) error
Constants ¶
const ( LogLevelTrace = "trace" LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarn = "warn" LogLevelError = "error" )
Log level constants
Variables ¶
This section is empty.
Functions ¶
func CleanupTestWriter ¶
CleanupTestWriter removes temporary test files
func CreateCLIUpstreamServerLogger ¶
func CreateCLIUpstreamServerLogger(config *config.LogConfig, serverName string) (*zap.Logger, error)
CreateCLIUpstreamServerLogger creates a logger for CLI debugging that outputs to console
func CreateHTTPLogger ¶
CreateHTTPLogger creates a logger specifically for HTTP API requests
func CreateTestWriter ¶
CreateTestWriter creates a writer for testing that captures both file and memory output
func CreateUpstreamServerLogger ¶
CreateUpstreamServerLogger creates a logger for a specific upstream server
func DefaultLogConfig ¶
DefaultLogConfig returns default logging configuration
func EnsureLogDir ¶
EnsureLogDir creates the log directory if it doesn't exist
func GetLogFilePath ¶
GetLogFilePath returns the full path for a log file in the standard log directory
func GetLogFilePathWithDir ¶
GetLogFilePathWithDir returns the full path for a log file in a custom log directory
func ReadUpstreamServerLogTail ¶
func ReadUpstreamServerLogTail(config *config.LogConfig, serverName string, lines int) ([]string, error)
ReadUpstreamServerLogTail reads the last N lines from an upstream server log file
func SetupCommandLogger ¶
func SetupCommandLogger(serverCommand bool, logLevel string, logToFile bool, logDir string) (*zap.Logger, error)
SetupCommandLogger creates a logger for console commands with appropriate default levels serverCommand: if true, uses INFO level by default; if false, uses WARN level by default
Types ¶
type LogDirInfo ¶
type LogDirInfo struct {
Path string `json:"path"`
OS string `json:"os"`
Description string `json:"description"`
Standard string `json:"standard"`
}
LogDirInfo returns information about the log directory for different OS
func GetLogDirInfo ¶
func GetLogDirInfo() (*LogDirInfo, error)
GetLogDirInfo returns detailed information about the log directory
type LoggerInfo ¶
type LoggerInfo struct {
LogDir string `json:"log_dir"`
LogFile string `json:"log_file"`
Level string `json:"level"`
EnableFile bool `json:"enable_file"`
EnableConsole bool `json:"enable_console"`
MaxSize int `json:"max_size"`
MaxBackups int `json:"max_backups"`
MaxAge int `json:"max_age"`
Compress bool `json:"compress"`
JSONFormat bool `json:"json_format"`
CreatedAt time.Time `json:"created_at"`
}
LoggerInfo represents information about the logger setup
func GetLoggerInfo ¶
func GetLoggerInfo(config *config.LogConfig) (*LoggerInfo, error)
GetLoggerInfo returns information about the current logger configuration
type SecretSanitizer ¶
SecretSanitizer wraps a zapcore.Core to sanitize sensitive values from logs
func NewSecretSanitizer ¶
func NewSecretSanitizer(core zapcore.Core) *SecretSanitizer
NewSecretSanitizer creates a new sanitizing core that wraps the provided core
func (*SecretSanitizer) Check ¶
func (s *SecretSanitizer) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check delegates to the wrapped core
func (*SecretSanitizer) RegisterResolvedSecret ¶
func (s *SecretSanitizer) RegisterResolvedSecret(value string)
RegisterResolvedSecret registers a secret value that was resolved from keyring/env so it can be masked in logs
func (*SecretSanitizer) UnregisterResolvedSecret ¶
func (s *SecretSanitizer) UnregisterResolvedSecret(value string)
UnregisterResolvedSecret removes a secret from the mask cache