config

package
v0.0.0-...-3e9a38d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorReadConfigFile1 = errutil.NewFactory("Failed to read config file: %q")
	ErrorUnmarshalConfig = errutil.NewFactory("Failed unmarshalling config json")
)

errors

View Source
var (
	ErrorUnknownFilterType = errutil.NewFactory("unknown filter config type: %q")
	ErrorInitFilter        = errutil.NewFactory("filter initialization failed: %q")
)

errors

View Source
var (
	ErrorUnknownInputType1 = errutil.NewFactory("unknown input config type: %q")
	ErrorRunInput1         = errutil.NewFactory("run input module failed: %q")
)

errors

View Source
var (
	ErrorUnknownOutputType1 = errutil.NewFactory("unknown output config type: %q")
	ErrorRunOutput1         = errutil.NewFactory("run output module failed: %q")
)

errors

View Source
var (
	// Logger app logger
	Logger = logutil.DefaultLogger
)

Functions

func CleanComments

func CleanComments(data []byte) (out []byte, err error)

CleanComments used for remove non-standard json comments. Supported comment formats format 1: ^\s*# format 2: ^\s*//

func ReflectConfig

func ReflectConfig(confraw *ConfigRaw, conf interface{}) (err error)

func RegistFilterHandler

func RegistFilterHandler(name string, handler FilterHandler)

func RegistInputHandler

func RegistInputHandler(name string, handler InputHandler)

func RegistOutputHandler

func RegistOutputHandler(name string, handler OutputHandler)

Types

type CommonConfig

type CommonConfig struct {
	inject.Injector `json:"-"`
	Type            string `json:"type"`
}

func (*CommonConfig) GetType

func (t *CommonConfig) GetType() string

func (*CommonConfig) Invoke

func (t *CommonConfig) Invoke(f interface{}) (refvs []reflect.Value, err error)

func (*CommonConfig) SetInjector

func (t *CommonConfig) SetInjector(inj inject.Injector)

type Config

type Config struct {
	inject.Injector `json:"-"`
	InputRaw        []ConfigRaw `json:"input,omitempty"`
	FilterRaw       []ConfigRaw `json:"filter,omitempty"`
	OutputRaw       []ConfigRaw `json:"output,omitempty"`
}

func LoadFromData

func LoadFromData(data []byte) (config Config, err error)

func LoadFromFile

func LoadFromFile(path string) (config Config, err error)

func LoadFromString

func LoadFromString(text string) (config Config, err error)

func (*Config) InvokeSimple

func (t *Config) InvokeSimple(arg interface{}) (err error)

func (*Config) RunFilters

func (t *Config) RunFilters() (err error)

func (*Config) RunInputs

func (t *Config) RunInputs() (err error)

func (*Config) RunOutputs

func (t *Config) RunOutputs() (err error)

type ConfigRaw

type ConfigRaw map[string]interface{}

type FilterConfig

type FilterConfig struct {
	CommonConfig
}

type FilterHandler

type FilterHandler interface{}

type InChan

type InChan chan logevent.LogEvent

type InputConfig

type InputConfig struct {
	CommonConfig
}

type InputHandler

type InputHandler interface{}

type OutChan

type OutChan chan logevent.LogEvent

type OutputConfig

type OutputConfig struct {
	CommonConfig
}

type OutputHandler

type OutputHandler interface{}

type TypeConfig

type TypeConfig interface {
	SetInjector(inj inject.Injector)
	GetType() string
	Invoke(f interface{}) (refvs []reflect.Value, err error)
}

type TypeFilterConfig

type TypeFilterConfig interface {
	TypeConfig
	Event(logevent.LogEvent) logevent.LogEvent
}

type TypeInputConfig

type TypeInputConfig interface {
	TypeConfig
	Start()
}

type TypeOutputConfig

type TypeOutputConfig interface {
	TypeConfig
	Event(event logevent.LogEvent) (err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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