示例#1
0
func createFilterCodec(unused map[string]interface{}, callback core.CodecCallbackFunc, t *testing.T) core.Codec {
	config := core.NewConfig()

	factory, err := NewFilterCodecFactory(config, "", unused, "filter")
	if err != nil {
		t.Logf("Failed to create filter codec: %s", err)
		t.FailNow()
	}

	return factory.NewCodec(callback, 0)
}
示例#2
0
func createMultilineCodec(unused map[string]interface{}, callback core.CodecCallbackFunc, t *testing.T) core.Codec {
	config := core.NewConfig()
	config.General.MaxLineBytes = 1048576
	config.General.SpoolMaxBytes = 10485760

	factory, err := NewMultilineCodecFactory(config, "", unused, "multiline")
	if err != nil {
		t.Errorf("Failed to create multiline codec: %s", err)
		t.FailNow()
	}

	return factory.NewCodec(callback, 0)
}
示例#3
0
func (lc *LogCourier) loadConfig() error {
	lc.config = core.NewConfig()
	if err := lc.config.Load(lc.config_file); err != nil {
		return err
	}

	if lc.stdin {
		// TODO: Where to find stdin config for codec and fields?
	} else if len(lc.config.Files) == 0 {
		log.Warning("No file groups were found in the configuration.")
	}

	return nil
}