logwriter

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SizedLogWriter

type SizedLogWriter struct {
	RotateSize int
	Path       string
	FileMode   os.FileMode
	// contains filtered or unexported fields
}

Implements a line-by-line log file writer that appends to a file specified by Path until it reaches RotateSize bytes, at which point it will delete the file and start over with a fresh one.

Make sure to call Close() after this is no longer needed.

func (*SizedLogWriter) Close

func (w *SizedLogWriter) Close() error

Close cleans up the associated resources

func (*SizedLogWriter) File

func (w *SizedLogWriter) File() (*os.File, error)

func (*SizedLogWriter) Mode

func (w *SizedLogWriter) Mode() os.FileMode

func (*SizedLogWriter) Rotate

func (w *SizedLogWriter) Rotate() error

func (*SizedLogWriter) WriteLine

func (w *SizedLogWriter) WriteLine(line string) error

WriteLine appends a line to the end of the log file. If the log line would exceed the set RotateSize, then the log file will be rotated, and the line will be appended to the new log file.

Jump to

Keyboard shortcuts

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