filch

package
v1.76.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: BSD-3-Clause Imports: 7 Imported by: 12

Documentation

Overview

Package filch is a file system queue that pilfers your stderr. (A FILe CHannel that filches.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filch

type Filch struct {
	OrigStderr *os.File
	// contains filtered or unexported fields
}

A Filch uses two alternating files as a simplistic ring buffer.

func New

func New(filePrefix string, opts Options) (f *Filch, err error)

New creates a new filch around two log files, each starting with filePrefix.

func (*Filch) Close

func (f *Filch) Close() (err error)

Close closes the Filch, releasing all os resources.

func (*Filch) TryReadLine

func (f *Filch) TryReadLine() ([]byte, error)

TryReadline implements the logtail.Buffer interface.

func (*Filch) Write

func (f *Filch) Write(b []byte) (int, error)

Write implements the logtail.Buffer interface.

type Options

type Options struct {
	ReplaceStderr bool // dup over fd 2 so everything written to stderr comes here
	MaxFileSize   int
}

Jump to

Keyboard shortcuts

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