Documentation
¶
Overview ¶
Package logging provider logging facilities.
Index ¶
- Variables
- func Init(output io.Writer, enabledModules []Module)
- func LoggerFor(module Module) *log.Logger
- func NewLogger(w io.Writer) *log.Logger
- func NopLogger() *log.Logger
- func ParseExecLogPath(method string, rawPath string) (string, error)
- func ParseRawPath(name string, rawPath string) (string, error)
- func ValidateExecLogPath(rawPath string) error
- type FileLogger
- type InvalidModuleError
- type Module
Constants ¶
This section is empty.
Variables ¶
var AllModules = []Module{ ModuleLangServer, ModuleHandlers, ModuleEventBus, ModuleModules, ModuleCRDs, ModuleFilesystem, ModuleDocStore, ModulePerf, }
AllModules lists all available modules for logging.
var PerfLogger *log.Logger = NopLogger()
PerfLogger is a nil logger than can be set to a real one to log timing information from multiple places.
Functions ¶
func Init ¶
Init initializes the logging registry with the given output and enabled modules. This should be called once at startup before any components are created.
func LoggerFor ¶
LoggerFor returns a logger for the specified module. If the module is enabled, it returns a real logger; otherwise, it returns a NopLogger.
func ValidateExecLogPath ¶
Types ¶
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger wraps a file-based logger.
func NewFileLogger ¶
func NewFileLogger(rawPath string) (*FileLogger, error)
NewFileLogger creates a new file-based logger.
func (*FileLogger) Logger ¶
func (fl *FileLogger) Logger() *log.Logger
Logger returns the underlying logger.
func (*FileLogger) Writer ¶
func (fl *FileLogger) Writer() io.Writer
Writer returns the underlying io.Writer for the file logger.
type InvalidModuleError ¶
InvalidModuleError is returned when an invalid module name is specified.
func (*InvalidModuleError) Error ¶
func (e *InvalidModuleError) Error() string
type Module ¶
type Module string
Module represents a loggable component in the system.
func ParseModules ¶
ParseModules parses a comma-separated list of module names. The special value "all" enables all modules.