Skip to content

Commit

Permalink
Bugfix for wrong input data (missing structure - linebreaks etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
radekl committed Apr 19, 2018
1 parent 8be4f0f commit 6b70563
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/convox/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/Schibsted-Tech-Polska/convox-logs-parser/pkg/formats"
"strings"
"time"
)

type convoxFrame struct {
Expand All @@ -14,10 +15,19 @@ type convoxFrame struct {

func getConvoxFrame(s string) convoxFrame {
var sp = strings.Split(s, " ")
var cf = convoxFrame{
sp[0],
sp[1],
formats.New(strings.Join(sp[2:], " ")),
var cf convoxFrame
if len(sp) > 2 {
cf = convoxFrame{
sp[0],
sp[1],
formats.New(strings.Join(sp[2:], " ")),
}
} else {
cf = convoxFrame{
time.Now().String(),
"error/parsing",
formats.New(s),
}
}

return cf
Expand Down

0 comments on commit 6b70563

Please sign in to comment.