Documentation ¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func LevelPrefix(level int) string
- func NewBufferLogger() *bufferLogger
- func NewStandardLogger(w io.Writer) *standardLogger
- func NewVerboseLogger(w io.Writer) *standardLogger
- type FileWriter
- type LogfLogger
- func (ll *LogfLogger) Debugf(format string, v ...interface{})
- func (ll *LogfLogger) Errorf(format string, v ...interface{})
- func (ll *LogfLogger) Infof(format string, v ...interface{})
- func (ll *LogfLogger) Panicf(format string, v ...interface{})
- func (ll *LogfLogger) Printf(format string, v ...interface{})
- func (ll *LogfLogger) Warnf(format string, v ...interface{})
- func (ll *LogfLogger) WithPrefix(prefix string) Logger
- type Logfer
- type Logger
Constants ¶
const ( LevelPanic = iota LevelError LevelWarn LevelInfo LevelDebug )
const RFC3339UsecTz0 = "2006-01-02T15:04:05.000000Z07:00"
Variables ¶
var StderrLogger = NewStandardLogger(os.Stderr)
Functions ¶
func LevelPrefix ¶
func NewBufferLogger ¶
func NewBufferLogger() *bufferLogger
NewBufferLogger returns a new instance of bufferLogger.
func NewStandardLogger ¶
func NewVerboseLogger ¶
Types ¶
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.
type LogfLogger ¶
type LogfLogger struct {
// contains filtered or unexported fields
}
LogfLogger is a test 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) Errorf ¶
func (ll *LogfLogger) Errorf(format string, v ...interface{})
func (*LogfLogger) Infof ¶
func (ll *LogfLogger) Infof(format string, v ...interface{})
func (*LogfLogger) Panicf ¶
func (ll *LogfLogger) Panicf(format string, v ...interface{})
func (*LogfLogger) Printf ¶
func (ll *LogfLogger) Printf(format string, v ...interface{})
func (*LogfLogger) Warnf ¶
func (ll *LogfLogger) Warnf(format string, v ...interface{})
func (*LogfLogger) WithPrefix ¶ added in v3.32.0
func (ll *LogfLogger) WithPrefix(prefix string) Logger
WithPrefix does nothing for LogfLogger because I'm lazy.
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{}) // backward compatibility Debugf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Panicf(format string, v ...interface{}) // WithPrefix returns a new Logger with the same configuration as // this one, but all logs will have the given prefix. WithPrefix(prefix string) Logger }
Logger represents an interface for a shared logger.
var NopLogger Logger = &nopLogger{}
NopLogger represents a Logger that doesn't do anything.