Exemple #1
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	// logger
	logger = nlog.NewLogger(nil)
	logger.SetLevel(nlog.Error)

	// parse flags
	initOptions()

	// update logging level
	logger.SetLevelName(Options.Logging)

	// run and wait
	run()

	// clean up inputs and output
	cleanup()
}
Exemple #2
0
func main() {
	file := os.Args[1]

	logger := nlog.NewLogger(&nlog.Config{
		Level: nlog.Trace,
		Flag:  nlog.LstdFlags,
	})
	e := emitter{}

	plugin := in_tail.New(in_tail.Config{
		File:    file,
		Emitter: &e,
		Logger:  logger,
	})

	go waitSignal(plugin)

	if err := plugin.Start(); err != nil {
		fmt.Println(err)
	}
}