mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
Merge branch 'dev' into vod
This commit is contained in:
@@ -39,6 +39,9 @@ type Parser interface {
|
||||
|
||||
// LastLogline returns the last parsed log line
|
||||
LastLogline() string
|
||||
|
||||
// TransferReportHistory transfers the report history to another parser
|
||||
TransferReportHistory(Parser) error
|
||||
}
|
||||
|
||||
// Config is the config for the Parser implementation
|
||||
@@ -918,3 +921,21 @@ func (p *parser) ReportHistory() []ReportHistoryEntry {
|
||||
|
||||
return history
|
||||
}
|
||||
|
||||
func (p *parser) TransferReportHistory(dst Parser) error {
|
||||
pp, ok := dst.(*parser)
|
||||
if !ok {
|
||||
return fmt.Errorf("the target parser is not of the required type")
|
||||
}
|
||||
|
||||
p.logHistory.Do(func(l interface{}) {
|
||||
if l == nil {
|
||||
return
|
||||
}
|
||||
|
||||
pp.logHistory.Value = l
|
||||
pp.logHistory = pp.logHistory.Next()
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user