Documentation ¶
Index ¶
- func Dump(c context.Context, w io.Writer) (n int, err error)
- func MustDumpStdout(c context.Context)
- func Reset(c context.Context)
- func ShouldHaveLog(actual interface{}, expected ...interface{}) string
- func ShouldNotHaveLog(actual interface{}, expected ...interface{}) string
- func Use(c context.Context) context.Context
- type LogEntry
- type MemLogger
- func (m *MemLogger) Debugf(format string, args ...interface{})
- func (m *MemLogger) Dump(w io.Writer) (n int, err error)
- func (m *MemLogger) Errorf(format string, args ...interface{})
- func (m *MemLogger) Get(lvl logging.Level, msg string, data map[string]interface{}) *LogEntry
- func (m *MemLogger) GetFunc(f func(*LogEntry) bool) *LogEntry
- func (m *MemLogger) Has(lvl logging.Level, msg string, data map[string]interface{}) bool
- func (m *MemLogger) HasFunc(f func(*LogEntry) bool) bool
- func (m *MemLogger) Infof(format string, args ...interface{})
- func (m *MemLogger) LogCall(lvl logging.Level, calldepth int, format string, args []interface{})
- func (m *MemLogger) Messages() []LogEntry
- func (m *MemLogger) Reset()
- func (m *MemLogger) Warningf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
Dump is a convenience function to dump the current contents of the memory logger to the writer.
This will panic if the current logger is not a memory logger.
func MustDumpStdout ¶
MustDumpStdout is a convenience function to dump the current contents of the memory logger to stdout.
This will panic if the current logger is not a memory logger.
func Reset ¶
Reset is a convenience function to reset the current memory logger.
This will panic if the current logger is not a memory logger.
func ShouldHaveLog ¶
func ShouldHaveLog(actual interface{}, expected ...interface{}) string
ShouldHaveLog is a goconvey custom assertion which asserts that the logger has received a log. It takes up to 3 arguments. argument 1 (expected[0]) is the log level. argument 2 (expected[1]) is a substring the message. If omitted or the empty string, this value is not checked. argument 3 (expected[2]) is the fields data. If omitted or nil, this value is not checked.
func ShouldNotHaveLog ¶
func ShouldNotHaveLog(actual interface{}, expected ...interface{}) string
ShouldNotHaveLog is the inverse of ShouldHaveLog. It asserts that the logger has not seen such a log.
Types ¶
type MemLogger ¶
type MemLogger struct {
// contains filtered or unexported fields
}
MemLogger is an implementation of Logger. Zero value is a valid logger.
func (*MemLogger) Dump ¶
Dump dumps the current memory logger contents to the given writer in a human-readable format.
func (*MemLogger) Get ¶
Get returns the first matching log entry. Note that lvl, msg and data have to match the entry precisely.
func (*MemLogger) Has ¶
Has returns true iff the MemLogger contains the specified log message. Note that lvl, msg and data have to match the entry precisely.
func (*MemLogger) Messages ¶
Messages returns all of the log messages that this memory logger has recorded.