mirror of
https://github.com/openziti/zrok.git
synced 2025-02-03 20:10:13 +01:00
tail function (#748)
This commit is contained in:
parent
d26de73464
commit
054788cd18
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/openziti/zrok/agent/agentGrpc"
|
"github.com/openziti/zrok/agent/agentGrpc"
|
||||||
"github.com/openziti/zrok/agent/proctree"
|
"github.com/openziti/zrok/agent/proctree"
|
||||||
"github.com/openziti/zrok/sdk/golang/sdk"
|
"github.com/openziti/zrok/sdk/golang/sdk"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +55,14 @@ func (s *share) tail(data []byte) {
|
|||||||
}
|
}
|
||||||
close(s.ready)
|
close(s.ready)
|
||||||
} else {
|
} else {
|
||||||
pfxlog.ChannelLogger(s.token).Info(string(line))
|
if strings.HasPrefix(line, "{") {
|
||||||
|
in := make(map[string]interface{})
|
||||||
|
if err := json.Unmarshal([]byte(line), &in); err == nil {
|
||||||
|
pfxlog.ChannelLogger(s.token).Info(in)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pfxlog.ChannelLogger(s.token).Info(strings.Trim(line, "\n"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s.readBuffer.WriteString(line)
|
s.readBuffer.WriteString(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user