lognile

package module
v0.0.0-...-46a921a Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 13 Imported by: 0

README

Lognile

Golang实现的轻量级文件日志采集工具

快速上手

创建配置文件config.yaml

#要监听的日志路径
pattern :
    - ./_log/php-fpm-*.log
    - ./_log/nginx-*.log

#日志进度存储文件
db : lognile.db

启动程序加载配置,即可监听对应文件的日志新记录,新日志自动回调

package main

import "log"
import "github.com/boyxp/lognile"

func main() {
	lognile.Init("config.yaml", func(row map[string]string) {
		log.Println(row)
	})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(cfg string, callback func(log map[string]string))

Types

type Config

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

func (*Config) Db

func (C *Config) Db() string

func (*Config) Init

func (C *Config) Init(cfg string) *Config

func (*Config) Pattern

func (C *Config) Pattern() map[string][]string

type Lognile

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

func (*Lognile) Exit

func (L *Lognile) Exit()

func (*Lognile) Init

func (L *Lognile) Init(cfg string, callback func(log map[string]string))

type Offset

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

func (*Offset) Load

func (O *Offset) Load() sync.Map

func (*Offset) Save

func (O *Offset) Save(offset map[uint64]int64)

type Reader

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

func (*Reader) Close

func (R *Reader) Close()

func (*Reader) Name

func (R *Reader) Name() string

func (*Reader) Offset

func (R *Reader) Offset() int64

func (*Reader) Read

func (R *Reader) Read(wait bool, queue chan map[string]string)

func (*Reader) Rename

func (R *Reader) Rename(filename string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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