GitHub

Original file line numberDiff line numberDiff line change

@@ -23,7 +23,7 @@ type RuntimeLine struct {

2323

Error string

2424

}

2525
26-

var humanFormatterLineRE = regexp.MustCompile(`^(\[[^\]]+\]){2}\[zfs.cmd\]\[[^\]]+\]:\s+command\s+exited\s+(with|without)\s+error\s+(.+)`)

26+

var humanFormatterLineRE = regexp.MustCompile(`^(\[[^\]]+\]){2}\[zfs.cmd\]\[[^\]]+\]:\s+command\s+exited\s+with\s+(success|error)\s+(.+)`)

2727
2828

func parseSecs(s string) (time.Duration, error) {

2929

d, err := time.ParseDuration(s + "s")

Original file line numberDiff line numberDiff line change

@@ -30,7 +30,7 @@ func TestParseHumanFormatter(t *testing.T) {

3030

tcs := []testCase{

3131

{

3232

Name: "human-formatter-noerror",

33-

Input: `2020-04-04T00:00:05+02:00 [DEBG][jobname][zfs.cmd][task$stack$span.stack]: command exited without error usertime_s="0.008445" cmd="zfs list -H -p -o name -r -t filesystem,volume" systemtime_s="0.033783" invocation="84" total_time_s="0.037828619"`,

33+

Input: `2020-04-04T00:00:05+02:00 [DEBG][jobname][zfs.cmd][task$stack$span.stack]: command exited with success usertime_s="0.008445" cmd="zfs list -H -p -o name -r -t filesystem,volume" systemtime_s="0.033783" invocation="84" total_time_s="0.037828619"`,

3434

Expect: &RuntimeLine{

3535

Cmd: "zfs list -H -p -o name -r -t filesystem,volume",

3636

TotalTime: secs("0.037828619"),

@@ -54,7 +54,7 @@ func TestParseHumanFormatter(t *testing.T) {

5454

},

5555

{

5656

Name: "from graylog",

57-

Input: `2020-04-04T00:00:05+02:00 [DEBG][csnas][zfs.cmd][task$stack$span.stack]: command exited without error usertime_s="0" cmd="zfs send -i zroot/ezjail/synapse-12@zrepl_20200329_095518_000 zroot/ezjail/synapse-12@zrepl_20200329_102454_000" total_time_s="0.101598591" invocation="85" systemtime_s="0.041581"`,

57+

Input: `2020-04-04T00:00:05+02:00 [DEBG][csnas][zfs.cmd][task$stack$span.stack]: command exited with success usertime_s="0" cmd="zfs send -i zroot/ezjail/synapse-12@zrepl_20200329_095518_000 zroot/ezjail/synapse-12@zrepl_20200329_102454_000" total_time_s="0.101598591" invocation="85" systemtime_s="0.041581"`,

5858

Expect: &RuntimeLine{

5959

Cmd: "zfs send -i zroot/ezjail/synapse-12@zrepl_20200329_095518_000 zroot/ezjail/synapse-12@zrepl_20200329_102454_000",

6060

TotalTime: secs("0.101598591"),

Original file line numberDiff line numberDiff line change

@@ -35,7 +35,7 @@ func waitPostLogging(c *Cmd, u usage, err error, now time.Time) {

3535

WithField("usertime_s", u.user_secs)

3636
3737

if err == nil {

38-

log.Info("command exited without error")

38+

log.Info("command exited with success")

3939

} else {

4040

log.WithError(err).Info("command exited with error")

4141

}

Read the original on github.com ↗