Beispiel #1
0
// initLogglyLog attaches a loggly hook to our logging system.
func initLogglyLog(app *App) {

	if app.config.LogglyToken == "" {
		return
	}

	log.Infof(app.ctx, "Initializing loggly hook to: %s host: %s", app.config.LogglyToken, app.config.LogglyHost)

	hook := log.NewLogglyHook(app.config.LogglyToken)
	app.log.Logger.Hooks.Add(hook)

	go func() {
		<-app.ctx.Done()
		hook.Flush()
	}()
}
Beispiel #2
0
// initLogglyLog attaches a loggly hook to our logging system.
func initLogglyLog(app *App) {

	if app.config.LogglyToken == "" {
		return
	}

	log.WithFields(log.F{
		"token":       app.config.LogglyToken,
		"loggly_host": app.config.LogglyHost,
	}).Info("Initializing loggly hook")

	hook := log.NewLogglyHook(app.config.LogglyToken)
	log.DefaultLogger.Logger.Hooks.Add(hook)

	go func() {
		<-app.ctx.Done()
		hook.Flush()
	}()
}