Documentation ¶
Overview ¶
Package log provides utilities for watching log files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is a log file watcher.
func NewWatcher ¶
func NewWatcher(cfg *WatcherConfig) (*Watcher, error)
NewWatcher creates a new log watcher.
type WatcherConfig ¶
type WatcherConfig struct { Name string File string Handlers []WatcherHandler }
WatcherConfig is a log file watcher configuration.
type WatcherHandler ¶
type WatcherHandler interface { // Line is called for each processed line. Line(string) error // Finish is called after the log file has been closed. Finish() error }
WatcherHandler is a log file watcher handler.
type WatcherHandlerFactory ¶
type WatcherHandlerFactory interface { // New will create and return a WatcherHandler ready for use. New() (WatcherHandler, error) }
WatcherHandlerFactory is a factory interface for log file watcher handlers.
func AssertContains ¶
func AssertContains(text, message string) WatcherHandlerFactory
AssertContains returns a factory of log handlers which check that the given text is contained in the log output.
func AssertJSONContains ¶
func AssertJSONContains(key, value, message string) WatcherHandlerFactory
AssertJSONContains returns a factory of log handlers which check that the given key/value pair is contained encoded as JSON in the log output.
func AssertNotContains ¶
func AssertNotContains(text, message string) WatcherHandlerFactory
AssertNotContains returns a factory of log handlers which check that the given text is not contained in the log output.
func AssertNotJSONContains ¶
func AssertNotJSONContains(key, value, message string) WatcherHandlerFactory
AssertNotJSONContains returns a factory of log handlers which check that the given key/value pair is not contained encoded as JSON in the log output.