Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDir(srcDir, dstDir string) error
- func CopyFile(srcFile, dstFile string) error
- func IsDir(s string) bool
- func IsExist(s string) bool
- func IsFile(s string) bool
- func ModTime(filename string) time.Time
- func ReadFile(filename string) (string, error)
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func ResetDir(dirPath string) error
- func UnzipDir(zipFile, dstDir string) error
- func UnzipFile(zipFile *zip.File, dstFile string) error
- func ZipDir(srcDir, zipFilePath string) error
- type DefaultFilename
- type FilenameMaker
- type Logger
- type Options
- type Roller
- type TimeBasedFilename
Constants ¶
View Source
const ( DefaultFlushSizeLimit = 1 << 20 DefaultFlushInterval = 1 * time.Second MinFlushSizeLimit = 4096 MinFlushInterval = 100 * time.Millisecond )
Variables ¶
View Source
var ErrFilename = errors.New("wrong file name")
Functions ¶
func ReadLines ¶ added in v0.10.3
ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
func ReadLinesOffsetN ¶ added in v0.10.3
ReadLinesOffsetN reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset): n >= 0: at most n lines n < 0: whole file Ref: gopsutil
Types ¶
type DefaultFilename ¶
type DefaultFilename struct{}
func (*DefaultFilename) MakeFilename ¶
func (d *DefaultFilename) MakeFilename(name string) string
type FilenameMaker ¶
type TimeBasedFilename ¶
type TimeBasedFilename struct { // 文件目录 FilePath string // 文件名模板: run-%s.log FilenameTpl string // 日期时间模板: 060102 TimeTpl string // 时间标识相同则不生成新文件名: 221130 TimeTag string }
func (*TimeBasedFilename) MakeFilename ¶
func (t *TimeBasedFilename) MakeFilename(name string) string
Click to show internal directories.
Click to hide internal directories.