utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2016 License: Apache-2.0 Imports: 12 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckErrorValues

func CheckErrorValues(refvs []reflect.Value) (err error)

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)

Reflect config.

func RegistFilterHandler

func RegistFilterHandler(name string, handler FilterHandler)

Registe FilterHandler.

func RegistInputHandler

func RegistInputHandler(name string, handler InputHandler)

Registe InputHandler.

func RegistOutputHandler

func RegistOutputHandler(name string, handler OutputHandler)

Registe OutputHandler.

Types

type CommonConfig

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

Common config for logcool.

func (*CommonConfig) GetType

func (t *CommonConfig) GetType() string

Get config type.

func (*CommonConfig) Invoke

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

Invoke all reflect-values.

func (*CommonConfig) SetInjector

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

Set injector value.

type Config

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

config struct for config-raw.

func LoadDefaultConfig

func LoadDefaultConfig() (config Config, err error)

Laod default-config from string.

func LoadFromData

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

Load config from data([]byte).

func LoadFromFile

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

Load config from file.

func LoadFromString

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

Laod config from string.

func (*Config) InvokeSimple

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

Simple-invoke.

func (*Config) RunFilters

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

Run Filters

func (*Config) RunInputs

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

Run Inputs.

func (*Config) RunOutputs

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

Run Outputs.

type ConfigRaw

type ConfigRaw map[string]interface{}

config raw type.

type FilterConfig

type FilterConfig struct {
	CommonConfig
}

Filter base type struct.

type FilterHandler

type FilterHandler interface{}

FilterHandler type interface.

type InChan

type InChan chan logevent.LogEvent

In/Out chan.

type InputConfig

type InputConfig struct {
	CommonConfig
}

Input base type struct.

type InputHandler

type InputHandler interface{}

InputHandler type interface.

type OutChan

type OutChan chan logevent.LogEvent

type OutputConfig

type OutputConfig struct {
	CommonConfig
}

Output base type struct.

type OutputHandler

type OutputHandler interface{}

OutputHandler type interface.

type TypeConfig

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

Config struct for the logcool.

type TypeFilterConfig

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

Filter base type interface.

type TypeInputConfig

type TypeInputConfig interface {
	TypeConfig
	Start()
}

Input base type interface.

type TypeOutputConfig

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

Output base type interface.

Directories

Path Synopsis
Config for logcool run.Loading configuration files and information, as well as logcool operating logic.
Config for logcool run.Loading configuration files and information, as well as logcool operating logic.

Jump to

Keyboard shortcuts

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