logfile

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (

	//KB Kilobytes
	KB = 1 << (10 * iota)
	//MB Megabytes
	MB
	//GB Gigabytes
	GB
	//TB Terabytes
	TB

	// DefaultRotationRate defines the default value for rotation refresh rate
	DefaultRotationRate = time.Millisecond * 250
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFile

type LogFile struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LogFile structure definition A LogFile is a GZIP compressed file which rotates automatically

func OpenFile

func OpenFile(path string, perm os.FileMode, size int64) (*LogFile, error)

OpenFile opens a new file for logging

func (*LogFile) Close

func (l *LogFile) Close() error

Close closes the LogFile properly

func (*LogFile) Flush

func (l *LogFile) Flush() error

Flush method

func (*LogFile) Path

func (l *LogFile) Path() string

Path returns the path of the LogFile

func (*LogFile) Rotate

func (l *LogFile) Rotate() error

Rotate rotates the current LogFile

func (*LogFile) SetRefreshRate

func (l *LogFile) SetRefreshRate(rate time.Duration)

SetRefreshRate sets the rate at which the LogFile should check for rotating check DefaultRotationRate for default value

func (*LogFile) Write

func (l *LogFile) Write(b []byte) (int, error)

Write writes bytes into the LogFile

func (*LogFile) WriteString

func (l *LogFile) WriteString(s string) (int, error)

WriteString writes a string into the LogFile

Jump to

Keyboard shortcuts

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