@@ -6,12 +6,16 @@ import (
7 "runtime/debug"
7 "runtime/debug"
11 "gopkg.in/natefinch/lumberjack.v2"
12 "gopkg.in/natefinch/lumberjack.v2"
14−var initOnce sync.Once
16+ initOnce sync.Once
17+ initialized atomic.Bool
16func Init(logFile string, debug bool) {
20func Init(logFile string, debug bool) {
17 initOnce.Do(func() {
21 initOnce.Do(func() {
@@ -34,9 +38,14 @@ func Init(logFile string, debug bool) {
36 slog.SetDefault(slog.New(logger))
40 slog.SetDefault(slog.New(logger))
41+ initialized.Store(true)
45+func IsInitialized() bool {
46+ return initialized.Load()
40func RecoverPanic(name string, cleanup func()) {
49func RecoverPanic(name string, cleanup func()) {
41 if r := recover(); r != nil {
50 if r := recover(); r != nil {
42 // Create a timestamped panic log file
51 // Create a timestamped panic log file