Documentation
¶
Index ¶
- Constants
- func MapLogLevel(level string) commonv1.LogLevel
- type LogContext
- type LogEntry
- type Logger
- func (l *Logger) Debug(message string, args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) DisableConsoleOutput()
- func (l *Logger) EnableConsoleOutput()
- func (l *Logger) Error(message string, args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(message string)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(message string, args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Rotate()
- func (l *Logger) Subscribe() <-chan LogEntry
- func (l *Logger) Warn(message string, args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithFields(fields map[string]string) *LogContext
Constants ¶
View Source
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorGray = "\033[37m" ColorGreen = "\033[32m" ColorCyan = "\033[36m" ColorBrightRed = "\033[91m" ColorBrightYellow = "\033[93m" ColorBrightBlue = "\033[94m" ColorBrightGray = "\033[90m" )
ANSI color codes for console output
View Source
const ( ServiceNameWidth = 20 // Fixed width for service names LogLevelWidth = 7 // Fixed width for log levels (ERROR, WARN, etc.) - icons add +2 )
Column widths for better alignment (same as supervisor)
Variables ¶
This section is empty.
Functions ¶
func MapLogLevel ¶
MapLogLevel maps string log level to proto enum
Types ¶
type LogContext ¶
type LogContext struct {
// contains filtered or unexported fields
}
LogContext provides field-based logging
func (*LogContext) Error ¶
func (c *LogContext) Error(message string)
func (*LogContext) Info ¶
func (c *LogContext) Info(message string)
type LogEntry ¶
type LogEntry struct {
Time time.Time
Level string
Message string
Fields map[string]string
TraceID string
}
LogEntry represents a single log entry
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides structured logging with streaming support
func (*Logger) DisableConsoleOutput ¶
func (l *Logger) DisableConsoleOutput()
DisableConsoleOutput disables console output when streaming to supervisor
func (*Logger) EnableConsoleOutput ¶
func (l *Logger) EnableConsoleOutput()
EnableConsoleOutput enables console output (default behavior)
func (*Logger) WithFields ¶
func (l *Logger) WithFields(fields map[string]string) *LogContext
WithFields logs a message with additional fields
Click to show internal directories.
Click to hide internal directories.