-b and -n options not working?
Opened this issue · 3 comments
I tried the following options and neither one are generating 1 line or 1 byte in the beginning, then wait 100 seconds before logging 1 line or byte again:
flog -t log -n 1 -s 100 -w -l
or
flog -t log -b 1 -s 100 -w -l
Am I using it right? I want to generate 1 line every 100 seconds.
Thanks!
workaround: looks like if I take off -l and then I can just watch the command to generate log
-n
is for the number of lines of logs to generate. In your case, you should use flog -t log -d 100 -w -l
to generate 1 line of log every 100 seconds.
-s
is forcreation time interval for each log (in seconds)
. It does not actually sleep. But-d
does.
But there is no option to generate a log in the beginning without waiting for the delay.
// flog.go
for {
if delay > 0 {
time.Sleep(delay)
}
log := NewLog(option.Format, created)
writer.Write([]byte(log + "\n"))
created = created.Add(time.Duration(option.Sleep*float64(time.Second/time.Millisecond)) * time.Millisecond)
}
This helps @mingrammer !! Not sure how I missed it when reading the docs