diff --git a/cmd/gotail/gotail.go b/cmd/gotail/gotail.go index 4b5b5d3..12c61d3 100644 --- a/cmd/gotail/gotail.go +++ b/cmd/gotail/gotail.go @@ -12,7 +12,9 @@ import ( func args2config() (tail.Config, int64) { config := tail.Config{Follow: true} n := int64(0) + maxlinesize := int(0) flag.Int64Var(&n, "n", 0, "tail from the last Nth location") + flag.IntVar(&maxlinesize, "max", 0, "max line size") flag.BoolVar(&config.Follow, "f", false, "wait for additional data to be appended to the file") flag.BoolVar(&config.ReOpen, "F", false, "follow, and track file rename/rotation") flag.BoolVar(&config.Poll, "p", false, "use polling, instead of inotify") @@ -20,6 +22,7 @@ func args2config() (tail.Config, int64) { if config.ReOpen { config.Follow = true } + config.MaxLineSize = maxlinesize return config, n } diff --git a/tail.go b/tail.go index 87debed..e4b770b 100644 --- a/tail.go +++ b/tail.go @@ -234,7 +234,7 @@ func (tail *Tail) tailFileSync() { return } } - }else if err == io.EOF { + } else if err == io.EOF { if !tail.Follow { return } @@ -248,7 +248,7 @@ func (tail *Tail) tailFileSync() { } return } - }else { + } else { // non-EOF error tail.Killf("Error reading %s: %s", tail.Filename, err) return