item

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0, MIT, MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLogSize = 1024 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item interface {
	// The host which produce the log
	GetHost() string

	// The service produced the log listening on
	GetPort() string

	// The component produced the log. eg. pd, tidb, tikv.
	GetComponent() string

	// The log file name
	GetFileName() string

	// The time when the log produced
	GetTime() time.Time

	// The log level
	GetLevel() LevelType

	// The whole log content
	GetContent() []byte

	// Append log content
	AppendContent([]byte) error
}

Item represent a log entity

type ItemType

type ItemType int16
const (
	TypeInvalid ItemType = iota
	TypeTiDB
	TypeTiKV
	TypePD
	TypeTiDBSlowQuery
)

type LevelType

type LevelType int16
const (
	LevelInvalid LevelType = iota
	LevelFATAL
	LevelERROR
	LevelWARN
	LevelINFO
	LevelDEBUG
)

type LogItem

type LogItem struct {
	File      string    // name of log file
	Time      time.Time // timestamp of a single line log
	Level     LevelType // log level
	Host      string    // host ip
	Port      string    // port of component
	Component string    // name of component
	Content   []byte    // content of a entire line log
	Type      ItemType  // type of log file
}

The LogItem struct implements Item interface

func (*LogItem) AppendContent

func (l *LogItem) AppendContent(content []byte) error

func (*LogItem) GetComponent

func (l *LogItem) GetComponent() string

func (*LogItem) GetContent

func (l *LogItem) GetContent() []byte

func (*LogItem) GetFileName

func (l *LogItem) GetFileName() string

func (*LogItem) GetHost

func (l *LogItem) GetHost() string

func (*LogItem) GetLevel

func (l *LogItem) GetLevel() LevelType

func (*LogItem) GetPort

func (l *LogItem) GetPort() string

func (*LogItem) GetTime

func (l *LogItem) GetTime() time.Time

Jump to

Keyboard shortcuts

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