log

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverTypeFile  = "file"  // raw file
	DriverTypeFs    = "fs"    // file system (SeaweedFS)
	DriverTypeMongo = "mongo" // mongodb
	DriverTypeEs    = "es"    // elastic search
)
View Source
const (
	MetadataName = "metadata.json"
)

Variables

View Source
var (
	ErrInvalidType    = errors.New("invalid type")
	ErrNotImplemented = errors.New("not implemented")
)

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Init() (err error)
	Close() (err error)
	WriteLine(id string, line string) (err error)
	WriteLines(id string, lines []string) (err error)
	Find(id string, pattern string, skip int, limit int) (lines []string, err error)
	Count(id string, pattern string) (n int, err error)
}

func GetFileLogDriver

func GetFileLogDriver(options *FileLogDriverOptions) (driver Driver, err error)

func GetLogDriver

func GetLogDriver(logDriverType string, options interface{}) (driver Driver, err error)

type FileLogDriver

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

func (*FileLogDriver) Close

func (d *FileLogDriver) Close() (err error)

func (*FileLogDriver) Count

func (d *FileLogDriver) Count(id string, pattern string) (n int, err error)

func (*FileLogDriver) Find

func (d *FileLogDriver) Find(id string, pattern string, skip int, limit int) (lines []string, err error)

func (*FileLogDriver) Flush

func (d *FileLogDriver) Flush() (err error)

func (*FileLogDriver) Init

func (d *FileLogDriver) Init() (err error)

func (*FileLogDriver) WriteLine

func (d *FileLogDriver) WriteLine(id string, line string) (err error)

func (*FileLogDriver) WriteLines

func (d *FileLogDriver) WriteLines(id string, lines []string) (err error)

type FileLogDriverOptions

type FileLogDriverOptions struct {
	BaseDir string
	Ttl     time.Duration
}

type Message

type Message struct {
	Id  int64     `json:"id" bson:"id"`
	Msg string    `json:"msg" bson:"msg"`
	Ts  time.Time `json:"ts" bson:"ts"`
}

type Metadata

type Metadata struct {
	Size       int64  `json:"size,omitempty" bson:"size"`
	TotalLines int64  `json:"total_lines,omitempty" bson:"total_lines"`
	TotalBytes int64  `json:"total_bytes,omitempty" bson:"total_bytes"`
	Md5        string `json:"md5,omitempty" bson:"md5"`
}

Jump to

Keyboard shortcuts

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