Documentation
¶
Overview ¶
Package logstore owns byte bounds and deterministic retention for process logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RotateAtStartup ¶
RotateAtStartup bounds existing bootstrap/crash output, moves the latest non-empty process output into retention, and leaves the current inode empty for descriptors the service manager already opened.
Types ¶
type Policy ¶
Policy defines the hard size of the current file and how many same-sized backups are retained. Backups use the suffixes .1 (newest) through .N.
func BootstrapPolicy ¶
func BootstrapPolicy() Policy
func LifecyclePolicy ¶
func LifecyclePolicy() Policy
Log bounds have one owner so lifecycle, managed dependency, and bootstrap sinks cannot silently drift apart. Functions return values so callers cannot mutate process-wide policy.
func ManagedServerPolicy ¶
func ManagedServerPolicy() Policy
type RotatingWriter ¶
type RotatingWriter struct {
// contains filtered or unexported fields
}
RotatingWriter is a concurrent-safe, byte-bounded writer. Rotation copies the current file into the backup chain and truncates the current inode in place. Keeping the inode is important for service managers and subprocesses that may still hold an open descriptor for the current path.
func Open ¶
func Open(path string, policy Policy) (*RotatingWriter, error)
Open opens path for append and immediately brings any pre-existing files under policy. Directories are created with the project-standard mode.
func (*RotatingWriter) Close ¶
func (w *RotatingWriter) Close() error
Close closes the writer. It is safe to call more than once.
func (*RotatingWriter) RotateNow ¶
func (w *RotatingWriter) RotateNow() error
RotateNow snapshots a non-empty current file and truncates its inode in place. It is used at process start for the small pre-logger crash sink.