fix: Showing beam heading on map even if no call is entered
This commit is contained in:
@@ -11,14 +11,16 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
mu sync.Mutex
|
||||
file *os.File
|
||||
path string
|
||||
mu sync.Mutex
|
||||
file *os.File
|
||||
path string
|
||||
crashFile *os.File // kept open so the runtime can write a crash traceback to it
|
||||
)
|
||||
|
||||
// Init opens (creates) the log file in dataDir. On rotation we truncate
|
||||
@@ -57,6 +59,17 @@ func Init(dataDir string) (string, error) {
|
||||
file = f
|
||||
path = logPath
|
||||
|
||||
// Capture a full traceback on a FATAL crash (a Go panic that escapes our
|
||||
// recover()s, or a runtime-fatal error like a concurrent map write, or a
|
||||
// Windows access violation routed through the Go signal handler) into a
|
||||
// dedicated file the runtime writes directly — so otherwise-silent process
|
||||
// deaths leave a stack we can read.
|
||||
if cf, cerr := os.OpenFile(filepath.Join(dataDir, "opslog-crash.log"),
|
||||
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644); cerr == nil {
|
||||
crashFile = cf
|
||||
_ = debug.SetCrashOutput(cf, debug.CrashOptions{})
|
||||
}
|
||||
|
||||
// Redirect log.Print* and the standard logger to the file too, so
|
||||
// any third-party output stays consistent.
|
||||
log.SetOutput(io.MultiWriter(file, os.Stderr))
|
||||
|
||||
Reference in New Issue
Block a user