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.


This section is empty.


This section is empty.


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.

Source Files