log

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChunkSize is the default value for the ChunkSize option
	DefaultChunkSize = 1024

	// DefaultMaxBufferSize is the default value for the MaxBufferSize option
	DefaultMaxBufferSize = 1024000 // 1 MB
)

Variables

This section is empty.

Functions

func Compress

func Compress(files []*os.File, dest string) error

Compress 压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址

func LogList

func LogList(c *gin.Context)

LogList 日志列表

func PathExists

func PathExists(path string) (bool, error)

判断文件或文件夹是否存在 如果返回的错误为nil,说明文件或文件夹存在 如果返回的错误类型使用os.IsNotExist()判断为true,说明文件或文件夹不存在 如果返回的错误为其它类型,则不确定是否在存在

func RegisterLogRouter

func RegisterLogRouter(r gin.IRouter)

func Upload

func Upload(c *gin.Context)

Upload 主动上传日志

Types

type ListResponse

type ListResponse struct {
	Logs     []LogInfo `json:"logs"`
	LastDay  string    `json:"last_day"`
	LastLine int       `json:"last_line"`
}

type LogInfo

type LogInfo struct {
	Level   string `json:"level"`
	Path    string `json:"caller"`
	Message string `json:"msg"`
	Time    string `json:"time"`
}

type Options

type Options struct {
	// ChunkSize specifies the size of the chunk that is read at once from the input.
	ChunkSize int

	// MaxBufferSize limits the maximum size of the buffer used internally.
	// This also limits the max line size.
	MaxBufferSize int
}

Options contains parameters that influence the internal working of the Scanner.

type Resp

type Resp struct {
	Status int    `json:"status"`
	Reason string `json:"reason"`
}

type Scanner

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

Scanner is the back-scanner implementation.

func BackScannerNew

func BackScannerNew(r io.ReaderAt, pos int) *Scanner

New returns a new Scanner.

func NewOptions

func NewOptions(r io.ReaderAt, pos int, o *Options) *Scanner

NewOptions returns a new Scanner with the given Options. Invalid option values are replaced with their default values.

func (*Scanner) Line

func (s *Scanner) Line() (line string, pos int, err error)

Line returns the next line from the input and its absolute byte-position. Line ending is cut from the line. Empty lines are also returned. After returning the last line (which is the first in the input), subsequent calls report io.EOF.

func (*Scanner) LineBytes

func (s *Scanner) LineBytes() (line []byte, pos int, err error)

LineBytes returns the bytes of the next line from the input and its absolute byte-position. Line ending is cut from the line. Empty lines are also returned. After returning the last line (which is the first in the input), subsequent calls report io.EOF.

This method is for efficiency if you need to inspect or search in the line. The returned line slice shares data with the internal buffer of the Scanner, and its content may be overwritten in subsequent calls to LineBytes() or Line(). If you need to retain the line data, make a copy of it or use the Line() method.

Jump to

Keyboard shortcuts

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