Documentation
¶
Index ¶
- Constants
- func NewScanner(r io.Reader) *scanner
- type ExternalLogFormatter
- type ExternalLogHandler
- type ExternalMatcher
- type FormatterAdapter
- type FormatterWrapper
- type HandlerAdapter
- type HandlerWrapper
- type LogFormatter
- type LogHandler
- type LogMessage
- type LogStreamError
- type MatcherAdapter
- type MatcherWrapper
- type MultilineMatcher
- type RetryPolicy
- type Streamer
- type StreamerConfig
Constants ¶
const DefaultMaxMultilines = 500
DefaultMaxMultilines is the default maximum number of lines in a multiline log
Variables ¶
This section is empty.
Functions ¶
func NewScanner ¶
NewScanner creates a new scanner for reading log lines
Types ¶
type ExternalLogFormatter ¶
type ExternalLogFormatter interface {
Format(interface{}) string
}
ExternalLogFormatter is an interface that represents external log formatters
type ExternalLogHandler ¶
type ExternalLogHandler interface {
OnLog(interface{})
OnError(error)
OnEnd()
}
ExternalLogHandler is an interface that represents external log handlers
type ExternalMatcher ¶
ExternalMatcher is an interface that represents external multiline matchers
type FormatterAdapter ¶
type FormatterAdapter struct {
ExternalFormatter ExternalLogFormatter
}
FormatterAdapter adapts internal LogMessage to external formatters
func NewFormatterAdapter ¶
func NewFormatterAdapter(formatter ExternalLogFormatter) *FormatterAdapter
NewFormatterAdapter creates a new FormatterAdapter
func (*FormatterAdapter) Format ¶
func (a *FormatterAdapter) Format(msg LogMessage) string
Format forwards the log message to the external formatter
type FormatterWrapper ¶
type FormatterWrapper struct {
// contains filtered or unexported fields
}
FormatterWrapper is a wrapper for external LogFormatter implementations
func NewFormatterWrapper ¶
func NewFormatterWrapper(formatter interface {
Format(interface{}) string
}) *FormatterWrapper
NewFormatterWrapper creates a new FormatterWrapper
func (*FormatterWrapper) Format ¶
func (w *FormatterWrapper) Format(msg LogMessage) string
Format formats a log message
type HandlerAdapter ¶
type HandlerAdapter struct {
ExternalHandler ExternalLogHandler
}
HandlerAdapter adapts internal LogMessage to external handlers
func NewHandlerAdapter ¶
func NewHandlerAdapter(handler ExternalLogHandler) *HandlerAdapter
NewHandlerAdapter creates a new HandlerAdapter
func (*HandlerAdapter) OnEnd ¶
func (a *HandlerAdapter) OnEnd()
OnEnd forwards the end signal to the external handler
func (*HandlerAdapter) OnError ¶
func (a *HandlerAdapter) OnError(err error)
OnError forwards the error to the external handler
func (*HandlerAdapter) OnLog ¶
func (a *HandlerAdapter) OnLog(msg LogMessage)
OnLog forwards the log message to the external handler
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper is a wrapper for external LogHandler implementations
func NewHandlerWrapper ¶
func NewHandlerWrapper(handler interface {
OnLog(interface{})
OnError(error)
OnEnd()
}) *HandlerWrapper
NewHandlerWrapper creates a new HandlerWrapper
func (*HandlerWrapper) OnError ¶
func (w *HandlerWrapper) OnError(err error)
OnError handles an error
func (*HandlerWrapper) OnLog ¶
func (w *HandlerWrapper) OnLog(msg LogMessage)
OnLog handles a log message
type LogFormatter ¶
type LogFormatter interface {
Format(LogMessage) string
}
LogFormatter is an interface for formatting log messages
type LogHandler ¶
type LogHandler interface {
OnLog(LogMessage)
OnError(error)
OnEnd()
}
LogHandler is an interface for handling log messages and errors
type LogMessage ¶
type LogMessage struct {
Namespace string
PodName string
ContainerName string
Timestamp time.Time
Message string
Raw []byte
}
LogMessage represents a single log entry from a kubernetes pod/container
type LogStreamError ¶
LogStreamError represents an error that occurred during log streaming
func NewLogStreamError ¶
func NewLogStreamError(err error, permanent bool, reason string) *LogStreamError
NewLogStreamError creates a new LogStreamError
func (*LogStreamError) Error ¶
func (e *LogStreamError) Error() string
Error implements the error interface
func (*LogStreamError) Unwrap ¶
func (e *LogStreamError) Unwrap() error
Unwrap returns the underlying error
type MatcherAdapter ¶
type MatcherAdapter struct {
ExternalMatcher ExternalMatcher
}
MatcherAdapter adapts external multiline matchers to internal interface
func NewMatcherAdapter ¶
func NewMatcherAdapter(matcher ExternalMatcher) *MatcherAdapter
NewMatcherAdapter creates a new MatcherAdapter
func (*MatcherAdapter) ShouldMerge ¶
func (a *MatcherAdapter) ShouldMerge(previous, next string) bool
ShouldMerge forwards the call to the external matcher
type MatcherWrapper ¶
type MatcherWrapper struct {
// contains filtered or unexported fields
}
MatcherWrapper is a wrapper for external MultilineMatcher implementations
func NewMatcherWrapper ¶
func NewMatcherWrapper(matcher interface {
ShouldMerge(previous, next string) bool
}) *MatcherWrapper
NewMatcherWrapper creates a new MatcherWrapper
func (*MatcherWrapper) ShouldMerge ¶
func (w *MatcherWrapper) ShouldMerge(previous, next string) bool
ShouldMerge determines if the next line should be merged with the previous line
type MultilineMatcher ¶
MultilineMatcher is an interface for matching multiline log entries
type RetryPolicy ¶
type RetryPolicy struct {
MaxRetries int
InitialInterval time.Duration
MaxInterval time.Duration
Multiplier float64
}
RetryPolicy configures the retry behavior for transient errors
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer handles streaming logs from multiple pods
func NewStreamer ¶
func NewStreamer(config *StreamerConfig) (*Streamer, error)
NewStreamer creates a new Streamer with the provided configuration
type StreamerConfig ¶
type StreamerConfig struct {
KubeClientProvider *kube.ClientProvider
Filter *filter.LogFilter
Handler LogHandler
Formatter LogFormatter
Matcher MultilineMatcher
RetryPolicy RetryPolicy
MaxMultilines int
}
StreamerConfig contains configuration for the streamer