logger

package
v2.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RFC3339UsecTz0 = "2006-01-02T15:04:05.000000Z07:00"

Variables

This section is empty.

Functions

func NewStandardLogger

func NewStandardLogger(w io.Writer) *standardLogger

func NewVerboseLogger

func NewVerboseLogger(w io.Writer) *verboseLogger

Types

type CaptureLogger

type CaptureLogger struct {
	Prints []string
	Debugs []string
}

CaptureLogger is a logger that stores all the print and debug messages it sees, useful for testing.

func NewCaptureLogger

func NewCaptureLogger() *CaptureLogger

NewCaptureLogger yields a CaptureLogger.

func (*CaptureLogger) Debugf

func (cl *CaptureLogger) Debugf(format string, v ...interface{})

Debugf formats a message and appends it to Debugs.

func (*CaptureLogger) Printf

func (cl *CaptureLogger) Printf(format string, v ...interface{})

Printf formats a message and appends it to Prints.

type FileWriter

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

FileWriter that can also be reopened

func NewFileWriter

func NewFileWriter(name string) (*FileWriter, error)

NewFileWriter opens a file for appending and writing and can be reopened. it is a ReopenWriteCloser...

func NewFileWriterMode

func NewFileWriterMode(name string, mode os.FileMode) (*FileWriter, error)

NewFileWriterMode opens a Reopener file with a specific permission

func (*FileWriter) Close

func (f *FileWriter) Close() error

Close calls the underlyding File.Close()

func (*FileWriter) Fd

func (f *FileWriter) Fd() uintptr

Fd returns the file descriptor of the underlying file.

func (*FileWriter) Reopen

func (f *FileWriter) Reopen() error

Reopen the file

func (*FileWriter) Write

func (f *FileWriter) Write(p []byte) (int, error)

Write implements the stander io.Writer interface

type LogfLogger

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

LogfLogger is a logger that wraps something that has a Logf interface and makes it act like our logger.

func NewLogfLogger

func NewLogfLogger(l Logfer) *LogfLogger

func (*LogfLogger) Debugf

func (ll *LogfLogger) Debugf(format string, v ...interface{})

func (*LogfLogger) Printf

func (ll *LogfLogger) Printf(format string, v ...interface{})

type Logfer

type Logfer interface {
	Logf(format string, v ...interface{})
}

Logfer is a thing that has only a Logf() method, like for instance, testing.T or testing.B.

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
	Debugf(format string, v ...interface{})
}

Logger represents an interface for a shared logger.

var NopLogger Logger = &nopLogger{}

NopLogger represents a Logger that doesn't do anything.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL