Documentation
¶
Overview ¶
Package logging owns the process's rotating diagnostics. An entry point installs it once; a Node never installs a handler. Records contain identifiers and lifecycle metadata, never operation payloads.
Index ¶
- Constants
- Variables
- func CurrentFile() (string, error)
- func Directory() string
- func Emit(level slog.Level, attrs ...slog.Attr)
- func Install(profile, application string) (func(), error)
- func Retain(profile string) error
- func SetReport(receive func(slog.Level, Fields))
- func Tail(path string) ([]byte, error)
- type Fields
- type Span
Constants ¶
const ( Begin = "begin" Admitted = "admitted" Completed = "completed" Failed = "failed" Cancelled = "cancelled" Interrupted = "interrupted" )
Phases of an observed operation.
const Target = "sailry"
Target is the message of every record this package owns. The handler writes those to the file and passes all others to the handler it replaced.
Variables ¶
ErrUnavailable reports that logging could not be installed.
Functions ¶
func CurrentFile ¶
CurrentFile is the active file, or the latest earlier daily file before the first record. It is "" when there is none.
func Directory ¶
func Directory() string
Directory is the profile's logs directory, "" before Install.
func Install ¶
Install starts the application's log under the profile at logs/<application>/current.log and makes it the slog default. application is "desktop" or "host". The returned function ends it after the Node has stopped. A second installation in one process fails.
func Retain ¶
Retain retires earlier daily files. A Node calls it only after it owns the profile, so a rejected second start cannot retire a running process's file. Other files, directories and links in the directory remain untouched.
Types ¶
type Fields ¶
Fields are a record's allowlisted values: strings, int64, uint64 and bool.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span observes one operation. It never cancels or replays the work it describes.
func NewBackground ¶
NewBackground observes a package's read at debug level.
func NewQuery ¶
NewQuery observes an ordinary read: only a slow completion, a failure or an uncertain outcome is recorded.
func (*Span) Finish ¶
Finish records the outcome once. code is "" for success; warn lowers an expected failure to a warning.