...

Package floggingtest

import "github.com/hyperledger/fabric/common/flogging/floggingtest"
Overview
Index

Overview ▾

Constants

DefaultFormat is a log encoding format that is mostly compatible with the default log format but excludes colorization and time.

const DefaultFormat = "[%{module}] %{shortfunc} -> %{level:.4s} %{id:04x} %{message}"

type Option

type Option func(r *RecordingCore, l *zap.Logger) *zap.Logger

func AtLevel

func AtLevel(level zapcore.Level) Option

func Named

func Named(loggerName string) Option

type Recorder

type Recorder struct {
    // contains filtered or unexported fields
}

func NewTestLogger

func NewTestLogger(tb testing.TB, options ...Option) (*flogging.FabricLogger, *Recorder)

func (*Recorder) Buffer

func (r *Recorder) Buffer() *gbytes.Buffer

func (*Recorder) Entries

func (r *Recorder) Entries() []string

func (*Recorder) EntriesContaining

func (r *Recorder) EntriesContaining(sub string) []string

func (*Recorder) EntriesMatching

func (r *Recorder) EntriesMatching(regex string) []string

func (*Recorder) Messages

func (r *Recorder) Messages() []string

func (*Recorder) MessagesContaining

func (r *Recorder) MessagesContaining(sub string) []string

func (*Recorder) MessagesMatching

func (r *Recorder) MessagesMatching(regex string) []string

func (*Recorder) Reset

func (r *Recorder) Reset()

type RecordingCore

type RecordingCore struct {
    zapcore.LevelEnabler
    // contains filtered or unexported fields
}

func (*RecordingCore) Check

func (r *RecordingCore) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry

func (*RecordingCore) Sync

func (r *RecordingCore) Sync() error

func (*RecordingCore) With

func (r *RecordingCore) With(fields []zapcore.Field) zapcore.Core

func (*RecordingCore) Write

func (r *RecordingCore) Write(e zapcore.Entry, fields []zapcore.Field) error

type TestingWriter

type TestingWriter struct{ testing.TB }

func (*TestingWriter) Sync

func (t *TestingWriter) Sync() error

func (*TestingWriter) Write

func (t *TestingWriter) Write(buf []byte) (int, error)