filewriter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBakFileNum = 32
	MaxFileSize   = 1 << 29
	TimeFormat    = "2006_01_02_15_04_05"
)

Variables

This section is empty.

Functions

func NewBakWriter

func NewBakWriter(ctx context.Context, path, name string) port.FileWriter

Types

type BakWriter

type BakWriter struct {
	// contains filtered or unexported fields
}

BakWriter The main functions are:

  1. Automatically cuts files based on the set file size.
  2. Automatically deletes redundant backup files based on the specified number of backup files.
  3. Write data to file with asynchronization.

func (*BakWriter) Done

func (w *BakWriter) Done() bool

Done Returns the log data output status. If true is retured, indicates that all log data has been written to a file.

func (*BakWriter) Serve

func (w *BakWriter) Serve()

Serve Launch a goroutine for asynchronization write data to file.

func (*BakWriter) Write

func (w *BakWriter) Write(data []byte)

Write Input data to in pipe. This opreation may block current goroutine

type FileList

type FileList []os.FileInfo

func NewFileList

func NewFileList(prefix string, infoList []os.FileInfo) FileList

func (FileList) Len

func (list FileList) Len() int

func (FileList) Less

func (list FileList) Less(i, j int) bool

func (FileList) Swap

func (list FileList) Swap(i, j int)

Jump to

Keyboard shortcuts

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