Compare commits

..

2 Commits

Author SHA1 Message Date
7d1a0b82bd add panic.log to gitignore 2025-12-17 14:38:39 +02:00
eef77fa240 add some debug info 2025-12-17 14:38:13 +02:00
2 changed files with 8 additions and 2 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
bin/ bin/
config.yaml config.yaml
*.sqlite3 *.sqlite3
panic.log

View File

@@ -9,6 +9,7 @@ import (
"path/filepath" "path/filepath"
"runtime/debug" "runtime/debug"
"syscall" "syscall"
"time"
"git.oblat.lv/alex/triggerssmith/api" "git.oblat.lv/alex/triggerssmith/api"
application "git.oblat.lv/alex/triggerssmith/internal/app" application "git.oblat.lv/alex/triggerssmith/internal/app"
@@ -89,7 +90,11 @@ var serveCmd = &cobra.Command{
slog.Error("Failed to open panic.log", slog.Any("error", err)) slog.Error("Failed to open panic.log", slog.Any("error", err))
} else { } else {
defer f.Close() defer f.Close()
f.WriteString(fmt.Sprintf("Panic: %v\n", r)) fmt.Fprintln(f, "\n--------------------------------------------------------\n")
fmt.Fprintf(f, "Time: %s\n", time.Now().Format(time.RFC3339))
fmt.Fprintln(f, "If this is unexpected, please report: https://git.oblat.lv/alex/triggerssmith/issues")
fmt.Fprintln(f, "\n--------------------------------------------------------\n")
fmt.Fprintf(f, "Panic: %v\n", r)
f.Write(stack) f.Write(stack)
f.WriteString("\n\n") f.WriteString("\n\n")
} }