filelog

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

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 added in v0.14.0

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

type FileController added in v0.14.0

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

func NewFileController added in v0.14.0

func NewFileController(config Config) *FileController

type FileInfo added in v0.14.0

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 added in v0.14.0

func (w *FileWriterByPeriod) Reset(cfg Config)

func (*FileWriterByPeriod) ServeHTTP added in v0.14.0

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

func (*FileWriterByPeriod) Watch added in v0.14.0

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 added in v0.14.0

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

func (*WatchHandler) Cancel added in v0.14.0

func (w *WatchHandler) Cancel()

type Watcher added in v0.14.0

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

func NewWatcher added in v0.14.0

func NewWatcher() *Watcher

func (*Watcher) Close added in v0.14.0

func (w *Watcher) Close()

func (*Watcher) Watch added in v0.14.0

func (w *Watcher) Watch() *WatchHandler

Jump to

Keyboard shortcuts

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