Documentation
¶
Overview ¶
Package applog writes the desktop app's log to a file, as well as to stderr. The app opened from the Finder, the Dock, the Start menu or a desktop launcher has no terminal: what it logged went nowhere, so a user asked for magpie's log had none to send (rayem1w on X, a Codex "hit a snag" through the gateway, 0.1.2330). Only the launch agent (`magpie daemon install`, serve.log) and a `magpie tui` that left the gateway running (serve.log in magpie's cache) kept one.
The file is app.log in appdir.Logs. It is the app's alone: the launch agent's serve.log, in the same folder on a Mac, is written by launchd for `magpie serve`, a process of its own. At 5 MiB app.log becomes app.old.log, over the one before, so two files at most are kept. A panic or fatal error's trace goes to the file too (debug.SetCrashOutput, or on Windows with no stderr, stderr itself: crash_windows.go), so a crash is in it, and a run that ended without quitting is said so by the next start (run.go).
What is logged names no key or token (the gateway logs header names, never values, and paths without their query); scrub masks what looks like one anyway, in case a vendor's error carries it.
Index ¶
Constants ¶
const ( // Name is the log's file name in appdir.Logs. Name = "app.log" // OldName is the log before the last rotation, kept beside it. OldName = "app.old.log" // Limit is the size at which the log is rotated. Limit = 5 << 20 )
Variables ¶
This section is empty.
Functions ¶
func Current ¶
func Current() string
Current is the log this process writes, or "" when it writes none (the TUI, `magpie serve`, a command).
func Ended ¶
func Ended(why string)
Ended logs that this run ends, and why, and removes its marker; once a run.
func Quitting ¶
func Quitting()
Quitting logs that the app has begun to quit, and notes it in its marker: a quit that never finishes (a step that hangs, then Windows ending it at shutdown) is told apart from one that never began.
func Running ¶
func Running()
Running marks this run as the app's, once it is the one that runs: a second launch hands its arguments to the running app and exits inside Wails (os.Exit, no quit), so a marker written before would read as a run that ended without quitting.
Types ¶
This section is empty.