filelog

package
v1.15.7 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBuffer = 1024 * 500

MaxBuffer buffer最大值

Variables

View Source
var (
	ErrorWriterNotOpen = errors.New("writer close")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Dir    string
	File   string
	Expire time.Duration
	Period LogPeriod
}

Config filelog-Transporter所需配置

func (*Config) IsUpdate

func (c *Config) IsUpdate(cfg *Config) bool

type FileController

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

func NewFileController

func NewFileController(config Config) *FileController

type FileInfo

type FileInfo struct {
	Name    string `json:"name,omitempty"`
	Size    string `json:"size,omitempty"`
	ModTime string `json:"modTime,omitempty"`
}

type FileWriterByPeriod

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

FileWriterByPeriod 文件周期写入

func NewFileWriteByPeriod

func NewFileWriteByPeriod(cfg Config) *FileWriterByPeriod

NewFileWriteByPeriod 获取新的FileWriterByPeriod

func (*FileWriterByPeriod) Close

func (w *FileWriterByPeriod) Close()

Close 关闭

func (*FileWriterByPeriod) Open

func (w *FileWriterByPeriod) Open(cfg Config)

Open 打开

func (*FileWriterByPeriod) Reset

func (w *FileWriterByPeriod) Reset(cfg Config)

func (*FileWriterByPeriod) ServeHTTP

func (w *FileWriterByPeriod) ServeHTTP(prefix string) http.Handler

func (*FileWriterByPeriod) Watch

func (w *FileWriterByPeriod) Watch() (*WatchHandler, error)

func (*FileWriterByPeriod) Write

func (w *FileWriterByPeriod) Write(p []byte) (n int, err error)

type LogPeriod

type LogPeriod interface {
	String() string
	FormatLayout() string
}

LogPeriod 日志周期

func ParsePeriod

func ParsePeriod(v string) LogPeriod

ParsePeriod 解析周期

type LogPeriodType

type LogPeriodType int

LogPeriodType 日志周期类型

const (
	//PeriodMonth 月
	PeriodMonth LogPeriodType = iota
	//PeriodDay 日
	PeriodDay
	//PeriodHour 时
	PeriodHour
)

func (LogPeriodType) FormatLayout

func (period LogPeriodType) FormatLayout() string

FormatLayout 格式化

func (LogPeriodType) String

func (period LogPeriodType) String() string

type WatchHandler

type WatchHandler struct {
	C chan []byte
	// contains filtered or unexported fields
}

func (*WatchHandler) Cancel

func (w *WatchHandler) Cancel()

type Watcher

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

func NewWatcher

func NewWatcher() *Watcher

func (*Watcher) Close

func (w *Watcher) Close()

func (*Watcher) Watch

func (w *Watcher) Watch() *WatchHandler

Jump to

Keyboard shortcuts

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