Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefTimeLayout for parse WatchRule.StartAt/EndAt DefTimeLayout = "2006-01-02 15:04:05" // DefLogTimeLayout for parse log time DefLogTimeLayout = "2006/01/02 15:04:05" // DefTimeLocation which location used for time parse DefTimeLocation = time.Local // Debug show debug message Debug bool // DefDebugLogger print debug message DefDebugLogger = log.New(os.Stderr, "", log.Ldate|log.Lmicroseconds|log.Lshortfile) // DefHandFunc the default handler is be used when rule.handler empty DefHandFunc = func(rule *WatchRule, matchedIdx uint64, logTime time.Time, line string) { fmt.Printf("rule(%s) matched one: %d, %s, %s\n", rule.Path, matchedIdx, logTime.Format(rule.TimeLayout), line) } )
Functions ¶
This section is empty.
Types ¶
type WatchRule ¶
type WatchRule struct {
Path string `json:"path"` // can be dir/file path
StartAtStr string `json:"start_at"`
EndAtStr string `json:"end_at"`
SeekEnd bool `json:"seek_end"` // is seek log file end when start process
Match string `json:"match"` // regexp
WatchDirMs int `json:"watch_dir_ms"`
LogTimeLayout string `json:"log_time_layout"`
TimeLayout string `json:"time_layout"`
TimeLocation *time.Location `json:"-"`
Poll bool `json:"poll"` // use poll instead inotify
Follow bool `json:"follow"` // equal to tail -f
Handler Handler `json:"-"`
HandlerWorkerNum int `json:"handler_worker_num"`
HandlerWorkerPool *grpool.Pool
// contains filtered or unexported fields
}
WatchRule log watch rule
Click to show internal directories.
Click to hide internal directories.