Пример #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

}
Пример #2
0
func init() {
	testLogger, _ = log.New()
	testLogger.Logger.Formatter.(*logrus.TextFormatter).DisableColors = true
	testLogger.Logger.Level = logrus.DebugLevel
}