mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
Fix receiving proper current command args, simplifying retrieval of last log line
This commit is contained in:
@@ -32,6 +32,9 @@ type Parser interface {
|
||||
|
||||
// ReportHistory returns an array of previews logs
|
||||
ReportHistory() []ReportHistoryEntry
|
||||
|
||||
// LastLogline returns the last parsed log line
|
||||
LastLogline() string
|
||||
}
|
||||
|
||||
// Config is the config for the Parser implementation
|
||||
@@ -71,6 +74,8 @@ type parser struct {
|
||||
logHistory *ring.Ring
|
||||
logHistoryLength int
|
||||
|
||||
lastLogline string
|
||||
|
||||
progress struct {
|
||||
ffmpeg ffmpegProgress
|
||||
avstream map[string]ffmpegAVstream
|
||||
@@ -622,6 +627,8 @@ func (p *parser) addLog(line string) {
|
||||
p.lock.log.Lock()
|
||||
defer p.lock.log.Unlock()
|
||||
|
||||
p.lastLogline = line
|
||||
|
||||
p.log.Value = process.Line{
|
||||
Timestamp: time.Now(),
|
||||
Data: line,
|
||||
@@ -646,6 +653,13 @@ func (p *parser) Log() []process.Line {
|
||||
return log
|
||||
}
|
||||
|
||||
func (p *parser) LastLogline() string {
|
||||
p.lock.log.RLock()
|
||||
defer p.lock.log.RUnlock()
|
||||
|
||||
return p.lastLogline
|
||||
}
|
||||
|
||||
func (p *parser) ResetStats() {
|
||||
p.lock.progress.Lock()
|
||||
defer p.lock.progress.Unlock()
|
||||
|
Reference in New Issue
Block a user