Documentation ¶
Index ¶
Constants ¶
View Source
const ( B int64 = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
Common bytes.
OpenFlag is used to open a file after rotation.
View Source
const OpenPerm os.FileMode = 0644
OpenPerm is used in *Open shortcuts to create a file.
View Source
const SuffixRe = `(\.[1-9]+)?$`
SuffixRe is a pattern of rotation counter suffix.
Variables ¶
View Source
var ErrNotSupported = fmt.Errorf("rotate: not supported on %s", runtime.GOOS)
ErrNotSupported is returned when rotation is not supported on a current system.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Bytes sets soft limit for file size. // Soft limit may be exceeded to write a message to a single file. // If Bytes == 0, no rotation happens. Bytes int64 // Count defines the maximum amount of files (open + rotated). // If Count <= 1, a file will be removed & created on Bytes size. Count int64 // Lock defines whether to lock on write. // Must be set for asynchronous writes. Lock bool }
Config defines rotating policy.
type File ¶
type File interface { io.Writer io.Closer Fd() uintptr Name() string Stat() (os.FileInfo, error) Sync() error WriteString(string) (int, error) }
File is an interface compatible with *os.File.
Click to show internal directories.
Click to hide internal directories.