mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
It's overkill for most purposes, but I'd say it doesn't hurt to have the extra resolution available in the raw JSON data for the few cases where it's useful. Have "lazygit -l" print them with milli-second resolution; that seems to be a good middle ground.
31 lines
635 B
Go
31 lines
635 B
Go
package tail
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/aybabtme/humanlog"
|
|
)
|
|
|
|
// TailLogs lets us run `lazygit --logs` to print the logs produced by other lazygit processes.
|
|
// This makes for easier debugging.
|
|
func TailLogs(logFilePath string) {
|
|
fmt.Printf("Tailing log file %s\n\n", logFilePath)
|
|
|
|
opts := humanlog.DefaultOptions
|
|
opts.Truncates = false
|
|
opts.TimeFormat = time.StampMilli
|
|
|
|
_, err := os.Stat(logFilePath)
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
log.Fatal("Log file does not exist. Run `lazygit --debug` first to create the log file")
|
|
}
|
|
log.Fatal(err)
|
|
}
|
|
|
|
tailLogsForPlatform(logFilePath, opts)
|
|
}
|