Documentation ¶
Index ¶
- Constants
- Variables
- func CheckErrorValues(refvs []reflect.Value) (err error)
- func CleanComments(data []byte) (out []byte, err error)
- func FormatWithEnv(text string) (result string)
- func FormatWithTime(text string) (result string)
- func ReflectConfig(confraw *ConfigRaw, conf interface{}) (err error)
- func RegistFilterHandler(name string, handler FilterHandler)
- func RegistInputHandler(name string, handler InputHandler)
- func RegistOutputHandler(name string, handler OutputHandler)
- type CommonConfig
- type Config
- func LoadDefaultConfig(ctx context.Context) (config Config, err error)
- func LoadFromData(ctx context.Context, data []byte) (config Config, err error)
- func LoadFromFile(ctx context.Context, path string) (config Config, err error)
- func LoadFromString(ctx context.Context, text string) (config Config, err error)
- type ConfigRaw
- type FilterConfig
- type FilterHandler
- type InChan
- type InputConfig
- type InputHandler
- type LogEvent
- func (le *LogEvent) AddTag(tags ...string)
- func (le LogEvent) Format(format string) (out string)
- func (le LogEvent) Get(field string) (v interface{})
- func (le LogEvent) GetString(field string) (v string)
- func (le LogEvent) MarshalIndent() (data []byte, err error)
- func (le LogEvent) MarshalJSON() (data []byte, err error)
- type OutChan
- type OutputConfig
- type OutputHandler
- type TypeConfig
- type TypeFilterConfig
- type TypeInputConfig
- type TypeOutputConfig
Constants ¶
const Defaultconfig = `` /* 270-byte string literal not displayed */
Variables ¶
var ( Logger = &logrus.Logger{ Out: os.Stdout, Formatter: &logrus.TextFormatter{ TimestampFormat: timestampFormat, }, Hooks: make(logrus.LevelHooks), Level: logrus.InfoLevel, } )
Functions ¶
func CheckErrorValues ¶
func CleanComments ¶
CleanComments used for remove non-standard json comments. Supported comment formats ^\s*# and ^\s*//
func FormatWithEnv ¶ added in v0.2.0
FormatWithEnv format string with environment value, ex: %{HOSTNAME}
func FormatWithTime ¶ added in v0.2.0
FormatWithTime format string with current time, ex: %{+2006-01-02}
func ReflectConfig ¶
ReflectConfig Reflect config.
func RegistFilterHandler ¶
func RegistFilterHandler(name string, handler FilterHandler)
RegistFilterHandler 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 ¶
CommonConfig Common config for logcool.
func (*CommonConfig) Invoke ¶
func (c *CommonConfig) Invoke(f interface{}) (refvs []reflect.Value, err error)
Invoke all reflect-values.
func (*CommonConfig) SetInjector ¶
func (c *CommonConfig) SetInjector(inj inject.Injector)
SetInjector Set injector value.
type Config ¶
type Config struct { inject.Injector `json:"-"` InputRaw []ConfigRaw `json:"input"` FilterRaw []ConfigRaw `json:"filter"` OutputRaw []ConfigRaw `json:"output"` }
Config config struct for config-raw.
func LoadDefaultConfig ¶
LoadDefaultConfig Load default-config from string.
func LoadFromData ¶
LoadFromData Load config from data([]byte).
func LoadFromFile ¶
LoadFromFile Load config from file.
func LoadFromString ¶
LoadFromString Load config from string.
func (*Config) InvokeSimple ¶
InvokeSimple Simple-invoke.
type LogEvent ¶ added in v0.2.0
type LogEvent struct { Timestamp time.Time `json:"timestamp"` Message string `json:"message"` Tags []string `json:"tags,omitempty"` Extra echo.Store `json:"-"` }
LogEvent struct that is also the Based struct.
func (LogEvent) Format ¶ added in v0.2.0
Format return string with current time / LogEvent field / ENV, ex: %{hostname}
func (LogEvent) MarshalIndent ¶ added in v0.2.0
MarshalIndent Marshal LogEvent to Indent
func (LogEvent) MarshalJSON ¶ added in v0.2.0
MarshalJSON Marshal LogEvent to Json
type TypeConfig ¶
type TypeConfig interface { SetInjector(inj inject.Injector) GetType() string Invoke(f interface{}) (refvs []reflect.Value, err error) }
TypeConfig Config struct for the logcool.
type TypeFilterConfig ¶
type TypeFilterConfig interface { TypeConfig Event(LogEvent) LogEvent }
TypeFilterConfig Filter base type interface.
type TypeInputConfig ¶
type TypeInputConfig interface { TypeConfig Start() }
Input base type interface.
type TypeOutputConfig ¶
type TypeOutputConfig interface { TypeConfig Event(ctx context.Context, event LogEvent) (err error) }
Output base type interface.