diff --git a/Makefile b/Makefile index a520ab8..d3adcc0 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ tests: go test -v ./... manual-check: - @echo "======= With Timestamp: ===========" + @echo "=========== With Everything: ===========" go run ./levelsDemo 2>&1 | TZ=UTC go run -race . - @echo "======= Without: ==================" - go run ./levelsDemo -logger-timestamp=false 2>&1 | TZ=UTC go run -race . + @echo "=========== Without Timestamp nor go Routine ID: ===========" + go run ./levelsDemo -logger-timestamp=false -logger-goroutine=false 2>&1 | go run -race . .PHONY: tests manual-check diff --git a/example.png b/example.png index 5596ea0..848ecd5 100644 Binary files a/example.png and b/example.png differ diff --git a/go.mod b/go.mod index 2abbc66..3b7c488 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.18 require ( fortio.org/cli v1.2.0 - fortio.org/log v1.7.0 - fortio.org/scli v1.8.0 + fortio.org/log v1.8.1 + fortio.org/scli v1.9.0 ) require ( @@ -13,6 +13,6 @@ require ( fortio.org/sets v1.0.3 // indirect fortio.org/version v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - golang.org/x/exp v0.0.0-20230420155640-133eef4313cb // indirect + golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect golang.org/x/sys v0.10.0 // indirect ) diff --git a/go.sum b/go.sum index f42a57d..6381b7b 100644 --- a/go.sum +++ b/go.sum @@ -3,18 +3,18 @@ fortio.org/cli v1.2.0 h1:MXmbYnbNHcclf0xYLZjeCnTINby7FpooJxR01+hnBmM= fortio.org/cli v1.2.0/go.mod h1:zJwHjRnvVqneF7ES+REfElc33xMjhbRDJslSrqIK9Kk= fortio.org/dflag v1.5.2 h1:F9XVRj4Qr2IbJP7BMj7XZc9wB0Q/RZ61Ool+4YPVad8= fortio.org/dflag v1.5.2/go.mod h1:ppb/A8u+KKg+qUUYZNYuvRnXuVb8IsdHb/XGzsmjkN8= -fortio.org/log v1.7.0 h1:4MbU81zqe/3RYuHpXADNgJwd2KEMAwmMUtuF5qtZTug= -fortio.org/log v1.7.0/go.mod h1:u/8/2lyczXq52aT5Nw6reD+3cR6m/EbS2jBiIYhgiTU= -fortio.org/scli v1.8.0 h1:JKxPdHeb1vAXFmaliPkfz0Eq2VI35LVUKileOfxdgks= -fortio.org/scli v1.8.0/go.mod h1:QdIJu32otZ3yGztI3NZoUriMZchXq06u2Ttp+/Tm6u8= +fortio.org/log v1.8.1 h1:Ybtjp+qDXb124ESnZ0XVuXJ6khDrWcom/C55YPupoKg= +fortio.org/log v1.8.1/go.mod h1:u/8/2lyczXq52aT5Nw6reD+3cR6m/EbS2jBiIYhgiTU= +fortio.org/scli v1.9.0 h1:laTn/mACr1+TRKH3ZKaQWw58kTzQ1ntpg2sH02KUJAA= +fortio.org/scli v1.9.0/go.mod h1:Ox3nhp3eJpF2rQsZ8fBKXqdJGQPTQHWEZpLikDnkzjY= fortio.org/sets v1.0.3 h1:HzewdGjH69YmyW06yzplL35lGr+X4OcqQt0qS6jbaO4= fortio.org/sets v1.0.3/go.mod h1:QZVj0r6KP/ZD9ebySW9SgxVNy/NjghUfyHW9NN+WU+4= fortio.org/version v1.0.2 h1:8NwxdX58aoeKx7T5xAPO0xlUu1Hpk42nRz5s6e6eKZ0= fortio.org/version v1.0.2/go.mod h1:2JQp9Ax+tm6QKiGuzR5nJY63kFeANcgrZ0osoQFDVm0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk= -golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= +golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/logc.go b/logc.go index ef9886c..a35a7bc 100644 --- a/logc.go +++ b/logc.go @@ -81,12 +81,14 @@ func ProcessLogLine(w io.Writer, prevDate *time.Time, noColor bool, line []byte) tsStr := "" reset := log.Colors.Reset darkGrey := log.Colors.DarkGray + grey := log.Colors.Gray // uppercase single letter level + color extraction lvl, color := LevelToColor(e.Level) if noColor { color = "" reset = "" darkGrey = "" + grey = "" } if e.TS != 0 { ts := e.Time() @@ -98,6 +100,9 @@ func ProcessLogLine(w io.Writer, prevDate *time.Time, noColor bool, line []byte) // Use full microseconds resolution unlike the log built in color version which stops at millis. tsStr = ts.Format(darkGrey + "15:04:05.000000 ") } + if e.R > 0 { + tsStr += fmt.Sprintf(grey+"[%d] ", e.R) + } fileLine := "" if e.Line != 0 { fileLine = fmt.Sprintf("%s:%d> ", e.File, e.Line)