files

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileError

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

FileError is an error related to a file, it will be appended to the message.

func (FileError) Error

func (err FileError) Error() string

Error returns the error that occured starting with the file that failed.

type FolderLoader

type FolderLoader struct {
	LogFolders []string
	// contains filtered or unexported fields
}

The FolderLoader can be used to keep watching for changes in a folder. It allows reading logs as they come in, by line or just the entire files.

func NewFolderLoader

func NewFolderLoader(logLocations []string) *FolderLoader

NewFolderLoader creates a new FolderLoader.

func (*FolderLoader) Close

func (loader *FolderLoader) Close() error

Close stops and closes this loader. It also notifies all channels to be closed.

func (*FolderLoader) ReadFile

func (loader *FolderLoader) ReadFile(filePath string) (string, error)

ReadFile reads the given log file if it exists and is in the scope of this reader.

func (*FolderLoader) StartWatching

func (loader *FolderLoader) StartWatching() (chan LogMessage, error)

StartWatching for logs and return a channel with the log output.

type LogMessage

type LogMessage struct {
	FilePath  string    // The file in which the message was logged.
	Timestamp time.Time // The time when it was logged.
	Text      string    // The text that was logged.
}

A LogMessage is created when something is logged.

Jump to

Keyboard shortcuts

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