Help us shape the future of Go! Take the 2026 Go Developer Survey

applog

package
v0.1.2637 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 12 Imported by: 0

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), so a crash is in it.

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

View Source
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 Path

func Path() string

Path is where the desktop app writes its log.

func Start

func Start(version, how string) (string, error)

Start sends the standard logger's output, and a crash's trace, to the log as well as to stderr, and logs that this magpie started. It answers the log's path; when the file can't be opened, the error, and the log goes to stderr alone as before.

func Stop

func Stop()

Stop sends the log to stderr alone again and closes the file: for tests, whose home is removed after them (Windows removes no folder with a file open in it).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL