log

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(params ...interface{})

Debug logs debug messages

func Error

func Error(params ...interface{})

Error logs ...errors

func Get

func Get() sts.Logger

Get returns the standard initialized logger if it exists

func GetDebug

func GetDebug() bool

GetDebug returns the current debug mode

func Info

func Info(params ...interface{})

Info logs general information

func Init

func Init(rootDir string, debug bool, mkdir MakeDir, open OpenFile)

Init creates a single logger instance for general logging

func InitExternal

func InitExternal(logger sts.Logger)

InitExternal sets the internal logger

func Recent

func Recent(n int) []string

Recent gets N most recent messages (info and error) - max 1000

func SetDebug

func SetDebug(on bool)

SetDebug sets debug mode to on or off

Types

type FileIO

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

FileIO implements sts.SendLogger and sts.ReceiveLogger

func NewFileIO

func NewFileIO(rootDir string, mkdir MakeDir, open OpenFile, keepInSync bool) *FileIO

NewFileIO creates a new FileIO logging instance

func (*FileIO) Parse

func (f *FileIO) Parse(
	handler func(name, renamed, hash string, size int64, t time.Time) bool,
	after time.Time, before time.Time) bool

Parse reads the log files in the provided time range and calls the handler on each record

func (*FileIO) Received

func (f *FileIO) Received(file sts.Received)

Received logs a file after it's been received

func (*FileIO) Sent

func (f *FileIO) Sent(file sts.Sent)

Sent logs a file after it's been sent

func (*FileIO) WasReceived

func (f *FileIO) WasReceived(relPath, hash string, after time.Time, before time.Time) bool

WasReceived tries to find the path specified between the times specified

func (*FileIO) WasSent

func (f *FileIO) WasSent(relPath, hash string, after time.Time, before time.Time) bool

WasSent tries to find the path specified between the times specified

type General

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

General is a rolling-file logger that implements sts.Logger

func NewGeneral

func NewGeneral(rootDir string, debug bool, mkdir MakeDir, open OpenFile) *General

NewGeneral creates a new General logging instance

func (*General) Debug

func (g *General) Debug(params ...interface{})

Debug logs debug messages (if set)

func (*General) Error

func (g *General) Error(params ...interface{})

Error logs errors

func (*General) Info

func (g *General) Info(params ...interface{})

Info logs general information

func (*General) Recent

func (g *General) Recent(n int) (msgs []string)

Recent gets the last N lines logged

type MakeDir

type MakeDir func(path string, perm os.FileMode) (err error)

MakeDir creates the full path to a directory

type OpenFile

type OpenFile func(path string, flag int, perm os.FileMode) (f *os.File, err error)

OpenFile opens a file

Jump to

Keyboard shortcuts

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