Ejemplo n.º 1
0
// ContextWithLogBuffer returns a context and a buffer into which the new, bound
// logger will write into.  This method allows you to inspect what data was
// logged more easily in your tests.
func ContextWithLogBuffer() (context.Context, *bytes.Buffer) {
	output := new(bytes.Buffer)
	l, _ := glog.New()
	l.Logger.Out = output
	l.Logger.Formatter.(*logrus.TextFormatter).DisableColors = true
	l.Logger.Level = logrus.DebugLevel

	ctx := glog.Context(context.Background(), l)
	return ctx, output

}
Ejemplo n.º 2
0
// initLog initialized the logging subsystem, attaching app.log and
// app.logMetrics.  It also configured the logger's level using Config.LogLevel.
func initLog(app *App) {
	l, m := log.New()
	l.Logger.Level = app.config.LogLevel
	app.log = l
	app.logMetrics = m
}
Ejemplo n.º 3
0
func init() {
	testLogger, _ = log.New()
	testLogger.Logger.Formatter.(*logrus.TextFormatter).DisableColors = true
	testLogger.Logger.Level = logrus.DebugLevel
}