mirror of
https://github.com/amir20/dozzle.git
synced 2026-01-04 12:05:07 +01:00
* fix: fixes std stream when type is unknown. see #2243 * fixes tests
This commit is contained in:
@@ -30,7 +30,8 @@ type dockerClient struct {
|
||||
type StdType int
|
||||
|
||||
const (
|
||||
STDOUT StdType = 1 << iota
|
||||
UNKNOWN StdType = 1 << iota
|
||||
STDOUT
|
||||
STDERR
|
||||
)
|
||||
const STDALL = STDOUT | STDERR
|
||||
@@ -38,13 +39,13 @@ const STDALL = STDOUT | STDERR
|
||||
func (s StdType) String() string {
|
||||
switch s {
|
||||
case STDOUT:
|
||||
return "out"
|
||||
return "stdout"
|
||||
case STDERR:
|
||||
return "err"
|
||||
return "stderr"
|
||||
case STDALL:
|
||||
return "all"
|
||||
default:
|
||||
return ""
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,15 +98,16 @@ func (g *eventGenerator) consume() {
|
||||
switch std {
|
||||
case "OUT":
|
||||
stdType = STDOUT
|
||||
message = message[3:]
|
||||
case "ERR":
|
||||
stdType = STDERR
|
||||
message = message[3:]
|
||||
default:
|
||||
log.Panicf("unknown std type [%s] with message [%s]", std, message)
|
||||
log.Debugf("unknown std type [%s] with message [%s]", std, message)
|
||||
stdType = UNKNOWN
|
||||
}
|
||||
|
||||
message = message[3:]
|
||||
|
||||
logEvent := &LogEvent{Id: h.Sum32(), Message: message, StdType: stdType}
|
||||
logEvent := &LogEvent{Id: h.Sum32(), Message: message, Stream: stdType.String()}
|
||||
|
||||
if index := strings.IndexAny(message, " "); index != -1 {
|
||||
logId := message[:index]
|
||||
|
||||
@@ -46,7 +46,7 @@ type LogEvent struct {
|
||||
Id uint32 `json:"id,omitempty"`
|
||||
Level string `json:"l,omitempty"`
|
||||
Position LogPosition `json:"p,omitempty"`
|
||||
StdType StdType `json:"s,omitempty"`
|
||||
Stream string `json:"s,omitempty"`
|
||||
}
|
||||
|
||||
func (l *LogEvent) HasLevel() bool {
|
||||
|
||||
Reference in New Issue
Block a user