logging

package
v0.0.0-...-6c293db Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

README

How to use it

Write:

db := New("path/to/data")

err := db.Save("log", "something")

Read:

db := New("path/to/data")

scanner := db.Query("logs", time.Now(), time.Now())

for scanner.Scan() {
	datapoint := scanner.Data()
}	

Documentation

Index

Constants

View Source
const DATE_LAYOUT = "2006-01-02 15:04:05"
View Source
const LAYOUT_LEN = len(DATE_LAYOUT)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPoint

type DataPoint struct {
	Time time.Time
	Text string
}

func (DataPoint) String

func (d DataPoint) String() string

type Logger

type Logger struct {
	Path string
	// contains filtered or unexported fields
}

func New

func New(path string, fs filesystem.FS) *Logger

func (*Logger) Close

func (db *Logger) Close() error

func (*Logger) Query

func (db *Logger) Query(table string, start, end time.Time, offset, size int, filter string) *Scanner

func (*Logger) Save

func (db *Logger) Save(table, data string, v ...interface{}) error

type Scanner

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

func (*Scanner) Close

func (s *Scanner) Close()

func (*Scanner) Data

func (s *Scanner) Data() (DataPoint, bool)

func (*Scanner) Scan

func (s *Scanner) Scan() bool

func (*Scanner) SetFilter

func (s *Scanner) SetFilter(v string)

Jump to

Keyboard shortcuts

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