core

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxLogSize = 5 * 1024 * 1024

MaxLogSize specifies the max size for a log (in this case 5MB) we do this because some of our output plugins have a limit on per entry size.

Max size per log = 5MB

Functions

func FileReader

func FileReader(filePath string, processFunc LineProcessor) error

func ValidateStruct

func ValidateStruct(requestObject interface{}) error

Types

type Config

type Config struct {
	Input      PluginConfig   `json:"input" yaml:"input"`
	Processors []PluginConfig `json:"processors" yaml:"processors"`
	Outputs    []PluginConfig `json:"outputs" yaml:"outputs"`
}

type ErrorHandler

type ErrorHandler func(criticalFailure bool, err error)

type Input

type Input interface {
	Run(errorHandler ErrorHandler, state State, processPipe chan<- PipelineResults)
	Stop()
}

type InputHandler

type InputHandler func(config []byte) (Input, error)

type LineProcessor

type LineProcessor func(string)

type LoadStateFunc

type LoadStateFunc func(id string) State

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})

	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Warnln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
	Panicln(args ...interface{})
}

type Output

type Output interface {
	Write(inputFile string) (int, error)
}

type OutputHandler

type OutputHandler func(config []byte) (Output, error)

type PipelineResults

type PipelineResults struct {
	FilePath    string
	ResultCount int
	State       State
	RetryCount  int
}

type PluginConfig

type PluginConfig struct {
	Name     string          `json:"name" yaml:"name"`
	Settings json.RawMessage `json:"settings,omitempty" yaml:"settings,omitempty"`
}

type ProcessHandler

type ProcessHandler func(config []byte) (Processor, error)

type Processor

type Processor interface {
	Process(inputFile string, writer io.Writer) error
}

type RotateWriter added in v0.3.0

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

func NewRotateWriter added in v0.3.0

func NewRotateWriter(filename string, maxSize int64) (*RotateWriter, error)

NewRotateWriter creates a new RotateWriter. Return nil if error occurs during setup.

func (*RotateWriter) Close added in v0.3.0

func (w *RotateWriter) Close() error

Close implements io.Closer, and closes the current logfile.

func (*RotateWriter) Write added in v0.3.0

func (w *RotateWriter) Write(p []byte) (n int, err error)

Write implements io.Writer.

func (*RotateWriter) WriteString added in v0.3.0

func (w *RotateWriter) WriteString(s string) (n int, err error)

type SaveStateFunc

type SaveStateFunc func(id string, state State) error

type State

type State []byte

type TmpWriter

type TmpWriter struct {
	WriteCount int
	// contains filtered or unexported fields
}

func NewTmpWriter

func NewTmpWriter() (*TmpWriter, error)

func (*TmpWriter) Close

func (l *TmpWriter) Close() error

Close implements io.Closer, and closes the current logfile.

func (*TmpWriter) Exit

func (l *TmpWriter) Exit() (err error)

Exit closes the open file and cleans up any current or previous log files

func (*TmpWriter) Name added in v0.4.1

func (l *TmpWriter) Name() string

Name returns current log file pointer

func (*TmpWriter) Rotate

func (l *TmpWriter) Rotate() (int, string, error)

Rotate causes TmpWriter to close the existing log file and immediately create a new one.

func (*TmpWriter) Size

func (l *TmpWriter) Size() int64

Size returns the current file size

func (*TmpWriter) Write

func (l *TmpWriter) Write(p []byte) (n int, err error)

Write implements io.Writer.

func (*TmpWriter) WriteString

func (l *TmpWriter) WriteString(s string) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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