disk

package
v0.0.0-...-acd42d9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetName = "disk"

	// OptDir is the directory on disk where log files should be stored.
	// Default "."
	OptDir = "dir"
)

Options in the disk's target config.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File is a locking representation of a file on disk. It satisfies the LogTarget interface. The lock is needed because Linux only guarantees that writes are atomic up to a certain size, but SLS does not limit the size of a request.

func NewFile

func NewFile(
	log sls.Logger,
	opts map[string]string,
) (*File, error)

NewFile returns a *disk.File that rotates over time and automatically removes old entries.

func (*File) Close

func (f *File) Close() error

Close the file after all writes complete. Once closed the underlying os.File cannot be reused.

func (*File) Name

func (f *File) Name() string

Name of the current logfile.

func (*File) Write

func (f *File) Write(byt []byte) (int, error)

Write to the Logfile. This is not threadsafe and must be called with a mutex lock.

Jump to

Keyboard shortcuts

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