Documentation ¶
Overview ¶
Package logging is a generated GoMock package.
Index ¶
- Variables
- func Sanitize(s string) string
- func SanitizeArgs(a []interface{}) []interface{}
- type Color
- type Config
- type Factory
- type Highlight
- type Level
- type Log
- func (l *Log) AssertDeferredNoError(f func() error)
- func (l *Log) AssertDeferredTrue(f func() bool, format string, args ...interface{})
- func (l *Log) AssertNoError(err error)
- func (l *Log) AssertTrue(b bool, format string, args ...interface{})
- func (l *Log) Debug(format string, args ...interface{})
- func (l *Log) Error(format string, args ...interface{})
- func (l *Log) Fatal(format string, args ...interface{})
- func (l *Log) GetDisplayLevel() Level
- func (l *Log) GetLogLevel() Level
- func (l *Log) Info(format string, args ...interface{})
- func (l *Log) RecoverAndExit(f, exit func())
- func (l *Log) RecoverAndPanic(f func())
- func (l *Log) SetContextualDisplayingEnabled(enabled bool)
- func (l *Log) SetDisplayLevel(lvl Level)
- func (l *Log) SetDisplayingEnabled(enabled bool)
- func (l *Log) SetLogLevel(lvl Level)
- func (l *Log) SetLoggingEnabled(enabled bool)
- func (l *Log) SetPrefix(prefix string)
- func (l *Log) Stop()
- func (l *Log) StopOnPanic()
- func (l *Log) Trace(format string, args ...interface{})
- func (l *Log) Verbo(format string, args ...interface{})
- func (l *Log) Warn(format string, args ...interface{})
- func (l *Log) Write(p []byte) (int, error)
- type Logger
- type MockLogger
- func (m *MockLogger) AssertDeferredNoError(f func() error)
- func (m *MockLogger) AssertDeferredTrue(f func() bool, format string, args ...interface{})
- func (m *MockLogger) AssertNoError(err error)
- func (m *MockLogger) AssertTrue(b bool, format string, args ...interface{})
- func (m *MockLogger) Debug(format string, args ...interface{})
- func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
- func (m *MockLogger) Error(format string, args ...interface{})
- func (m *MockLogger) Fatal(format string, args ...interface{})
- func (m *MockLogger) GetDisplayLevel() Level
- func (m *MockLogger) GetLogLevel() Level
- func (m *MockLogger) Info(format string, args ...interface{})
- func (m *MockLogger) RecoverAndExit(f, exit func())
- func (m *MockLogger) RecoverAndPanic(f func())
- func (m *MockLogger) SetContextualDisplayingEnabled(arg0 bool)
- func (m *MockLogger) SetDisplayLevel(arg0 Level)
- func (m *MockLogger) SetDisplayingEnabled(arg0 bool)
- func (m *MockLogger) SetLogLevel(arg0 Level)
- func (m *MockLogger) SetLoggingEnabled(arg0 bool)
- func (m *MockLogger) SetPrefix(arg0 string)
- func (m *MockLogger) Stop()
- func (m *MockLogger) StopOnPanic()
- func (m *MockLogger) Trace(format string, args ...interface{})
- func (m *MockLogger) Verbo(format string, args ...interface{})
- func (m *MockLogger) Warn(format string, args ...interface{})
- func (m *MockLogger) Write(p []byte) (int, error)
- type MockLoggerMockRecorder
- func (mr *MockLoggerMockRecorder) AssertDeferredNoError(f interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) AssertDeferredTrue(f, format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) AssertNoError(err interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) AssertTrue(b, format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Debug(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Error(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Fatal(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) GetDisplayLevel() *gomock.Call
- func (mr *MockLoggerMockRecorder) GetLogLevel() *gomock.Call
- func (mr *MockLoggerMockRecorder) Info(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) RecoverAndExit(f, exit interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) RecoverAndPanic(f interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetContextualDisplayingEnabled(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetDisplayLevel(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetDisplayingEnabled(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetLogLevel(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetLoggingEnabled(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) SetPrefix(arg0 interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Stop() *gomock.Call
- func (mr *MockLoggerMockRecorder) StopOnPanic() *gomock.Call
- func (mr *MockLoggerMockRecorder) Trace(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Verbo(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Warn(format interface{}, args ...interface{}) *gomock.Call
- func (mr *MockLoggerMockRecorder) Write(p interface{}) *gomock.Call
- type MockRotatingWriter
- func (m *MockRotatingWriter) Close() error
- func (m *MockRotatingWriter) EXPECT() *MockRotatingWriterMockRecorder
- func (m *MockRotatingWriter) Flush() error
- func (m *MockRotatingWriter) Initialize(arg0 Config) (int, error)
- func (m *MockRotatingWriter) Rotate() error
- func (m *MockRotatingWriter) Write(b []byte) (int, error)
- func (m *MockRotatingWriter) WriteString(s string) (int, error)
- type MockRotatingWriterMockRecorder
- func (mr *MockRotatingWriterMockRecorder) Close() *gomock.Call
- func (mr *MockRotatingWriterMockRecorder) Flush() *gomock.Call
- func (mr *MockRotatingWriterMockRecorder) Initialize(arg0 interface{}) *gomock.Call
- func (mr *MockRotatingWriterMockRecorder) Rotate() *gomock.Call
- func (mr *MockRotatingWriterMockRecorder) Write(b interface{}) *gomock.Call
- func (mr *MockRotatingWriterMockRecorder) WriteString(s interface{}) *gomock.Call
- type NoFactory
- func (NoFactory) Close()
- func (NoFactory) GetDisplayLevel(name string) (Level, error)
- func (NoFactory) GetLogLevel(name string) (Level, error)
- func (NoFactory) GetLoggerNames() []string
- func (NoFactory) Make(string) (Logger, error)
- func (NoFactory) MakeChain(string) (Logger, error)
- func (NoFactory) MakeChainChild(string, string) (Logger, error)
- func (NoFactory) SetDisplayLevel(name string, level Level) error
- func (NoFactory) SetLogLevel(name string, level Level) error
- type NoIOWriter
- type NoLog
- func (NoLog) AssertDeferredNoError(f func() error)
- func (NoLog) AssertDeferredTrue(f func() bool, format string, args ...interface{})
- func (NoLog) AssertNoError(error)
- func (NoLog) AssertTrue(b bool, format string, args ...interface{})
- func (NoLog) Debug(format string, args ...interface{})
- func (NoLog) Error(format string, args ...interface{})
- func (NoLog) Fatal(format string, args ...interface{})
- func (NoLog) GetDisplayLevel() Level
- func (NoLog) GetLogLevel() Level
- func (NoLog) Info(format string, args ...interface{})
- func (NoLog) RecoverAndExit(f, exit func())
- func (NoLog) RecoverAndPanic(f func())
- func (NoLog) SetContextualDisplayingEnabled(bool)
- func (NoLog) SetDisplayLevel(Level)
- func (NoLog) SetDisplayingEnabled(bool)
- func (NoLog) SetLogLevel(Level)
- func (NoLog) SetLoggingEnabled(bool)
- func (NoLog) SetPrefix(string)
- func (NoLog) Stop()
- func (NoLog) StopOnPanic()
- func (NoLog) Trace(format string, args ...interface{})
- func (NoLog) Verbo(format string, args ...interface{})
- func (NoLog) Warn(format string, args ...interface{})
- func (NoLog) Write([]byte) (int, error)
- type RotatingWriter
- type RoutineID
- type Stacktrace
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultLogDirectory is the default directory where logs are saved DefaultLogDirectory = fmt.Sprintf("%s/.%s/logs", homeDir, constants.AppName) // DefaultConfig provides a reasonable default logger configuration. It // should not be modified, it should be copied if changes are intended on // being made. DefaultConfig = Config{ RotationInterval: 24 * time.Hour, FileSize: 8 * units.MiB, RotationSize: 7, FlushSize: 1, DisplayLevel: Info, DisplayHighlight: Plain, LogLevel: Debug, Directory: DefaultLogDirectory, } )
Functions ¶
func SanitizeArgs ¶
func SanitizeArgs(a []interface{}) []interface{}
Types ¶
type Color ¶
type Color string
const ( Black Color = "\033[0;30m" DarkGray Color = "\033[1;30m" Red Color = "\033[0;31m" LightRed Color = "\033[1;31m" Green Color = "\033[0;32m" LightGreen Color = "\033[1;32m" Orange Color = "\033[0;33m" Yellow Color = "\033[1;33m" Blue Color = "\033[0;34m" LightBlue Color = "\033[1;34m" Purple Color = "\033[0;35m" LightPurple Color = "\033[1;35m" Cyan Color = "\033[0;36m" LightCyan Color = "\033[1;36m" LightGray Color = "\033[0;37m" White Color = "\033[1;37m" Reset Color = "\033[0;0m" Bold Color = "\033[;1m" Reverse Color = "\033[;7m" )
Colors
type Config ¶
type Config struct { RotationInterval time.Duration `json:"rotationInterval"` FileSize int `json:"fileSize"` RotationSize int `json:"rotationSize"` FlushSize int `json:"flushSize"` DisableLogging bool `json:"disableLogging"` DisableDisplaying bool `json:"disableDisplaying"` DisableContextualDisplaying bool `json:"disableContextualDisplaying"` DisableFlushOnWrite bool `json:"disableFlushOnWrite"` Assertions bool `json:"assertions"` LogLevel Level `json:"logLevel"` DisplayLevel Level `json:"displayLevel"` DisplayHighlight Highlight `json:"displayHighlight"` Directory string `json:"directory"` MsgPrefix string `json:"-"` LoggerName string `json:"-"` }
Config defines the configuration of a logger
type Factory ¶
type Factory interface { // Make creates a new logger with name [name] Make(name string) (Logger, error) // MakeChain creates a new logger to log the events of chain [chainID] MakeChain(chainID string) (Logger, error) // MakeChainChild creates a new sublogger for a [name] module of a chain [chainId] MakeChainChild(chainID string, name string) (Logger, error) // SetLogLevels sets log levels for all loggers in factory with given logger name, level pairs. SetLogLevel(name string, level Level) error // SetDisplayLevels sets log display levels for all loggers in factory with given logger name, level pairs. SetDisplayLevel(name string, level Level) error // GetLogLevels returns all log levels in factory as name, level pairs GetLogLevel(name string) (Level, error) // GetDisplayLevels returns all log display levels in factory as name, level pairs GetDisplayLevel(name string) (Level, error) // GetLoggerNames returns the names of all logs created by this factory GetLoggerNames() []string // Close stops and clears all of a Factory's instantiated loggers Close() }
Factory creates new instances of different types of Logger
func NewFactory ¶
NewFactory returns a new instance of a Factory producing loggers configured with the values set in the [config] parameter
type Highlight ¶
type Highlight int
Highlight mode to apply to displayed logs
func ToHighlight ¶
ToHighlight chooses a highlighting mode
func (*Highlight) MarshalJSON ¶
type Level ¶
type Level int
func (Level) AlignedString ¶
String representation of this level as it will appear in log files and in logs displayed to screen. The returned value has length [alignedStringLen].
func (Level) MarshalJSON ¶
func (*Level) UnmarshalJSON ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func NewTestLog ¶
func (*Log) AssertDeferredNoError ¶
func (*Log) AssertDeferredTrue ¶
func (*Log) AssertNoError ¶
func (*Log) AssertTrue ¶
func (*Log) GetDisplayLevel ¶
func (*Log) GetLogLevel ¶
func (*Log) RecoverAndExit ¶
func (l *Log) RecoverAndExit(f, exit func())
func (*Log) RecoverAndPanic ¶
func (l *Log) RecoverAndPanic(f func())
func (*Log) SetContextualDisplayingEnabled ¶
func (*Log) SetDisplayLevel ¶
func (*Log) SetDisplayingEnabled ¶
func (*Log) SetLogLevel ¶
func (*Log) SetLoggingEnabled ¶
func (*Log) StopOnPanic ¶
func (l *Log) StopOnPanic()
type Logger ¶
type Logger interface { io.Writer // For logging pre-formated messages // Log that a fatal error has occurred. The program should likely exit soon // after this is called Fatal(format string, args ...interface{}) // Log that an error has occurred. The program should be able to recover // from this error Error(format string, args ...interface{}) // Log that an event has occurred that may indicate a future error or // vulnerability Warn(format string, args ...interface{}) // Log an event that may be useful for a user to see to measure the progress // of the protocol Info(format string, args ...interface{}) // Log an event that may be useful for understanding the order of the // execution of the protocol Trace(format string, args ...interface{}) // Log an event that may be useful for a programmer to see when debuging the // execution of the protocol Debug(format string, args ...interface{}) // Log extremely detailed events that can be useful for inspecting every // aspect of the program Verbo(format string, args ...interface{}) // If assertions are enabled, will result in a panic if err is non-nil AssertNoError(err error) // If assertions are enabled, will result in a panic if b is false AssertTrue(b bool, format string, args ...interface{}) // If assertions are enabled, the function will be called and will result in // a panic the returned value is non-nil AssertDeferredNoError(f func() error) // If assertions are enabled, the function will be called and will result in // a panic the returned value is false AssertDeferredTrue(f func() bool, format string, args ...interface{}) // Recovers a panic, logs the error, and rethrows the panic. StopOnPanic() // If a function panics, this will log that panic and then re-panic ensuring // that the program logs the error before exiting. RecoverAndPanic(f func()) // If a function panics, this will log that panic and then call the exit // function, ensuring that the program logs the error, recovers, and // executes the desired exit function RecoverAndExit(f, exit func()) // Only events above or equal to the level set will be logged SetLogLevel(Level) // Only logged events above or equal to the level set will be logged SetDisplayLevel(Level) // Gets current LogLevel GetLogLevel() Level // Gets current DisplayLevel GetDisplayLevel() Level // Add a prefix to all logged messages SetPrefix(string) // Enable or disable logging SetLoggingEnabled(bool) // Enable or disable the display of logged events SetDisplayingEnabled(bool) // Enable or disable the display of contextual information for logged events SetContextualDisplayingEnabled(bool) // Stop this logger and write back all meta-data. Stop() }
Logger defines the interface that is used to keep a record of all events that happen to the program
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock of Logger interface.
func NewMockLogger ¶
func NewMockLogger(ctrl *gomock.Controller) *MockLogger
NewMockLogger creates a new mock instance.
func (*MockLogger) AssertDeferredNoError ¶
func (m *MockLogger) AssertDeferredNoError(f func() error)
AssertDeferredNoError mocks base method.
func (*MockLogger) AssertDeferredTrue ¶
func (m *MockLogger) AssertDeferredTrue(f func() bool, format string, args ...interface{})
AssertDeferredTrue mocks base method.
func (*MockLogger) AssertNoError ¶
func (m *MockLogger) AssertNoError(err error)
AssertNoError mocks base method.
func (*MockLogger) AssertTrue ¶
func (m *MockLogger) AssertTrue(b bool, format string, args ...interface{})
AssertTrue mocks base method.
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(format string, args ...interface{})
Debug mocks base method.
func (*MockLogger) EXPECT ¶
func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLogger) Error ¶
func (m *MockLogger) Error(format string, args ...interface{})
Error mocks base method.
func (*MockLogger) Fatal ¶
func (m *MockLogger) Fatal(format string, args ...interface{})
Fatal mocks base method.
func (*MockLogger) GetDisplayLevel ¶
func (m *MockLogger) GetDisplayLevel() Level
GetDisplayLevel mocks base method.
func (*MockLogger) GetLogLevel ¶
func (m *MockLogger) GetLogLevel() Level
GetLogLevel mocks base method.
func (*MockLogger) Info ¶
func (m *MockLogger) Info(format string, args ...interface{})
Info mocks base method.
func (*MockLogger) RecoverAndExit ¶
func (m *MockLogger) RecoverAndExit(f, exit func())
RecoverAndExit mocks base method.
func (*MockLogger) RecoverAndPanic ¶
func (m *MockLogger) RecoverAndPanic(f func())
RecoverAndPanic mocks base method.
func (*MockLogger) SetContextualDisplayingEnabled ¶
func (m *MockLogger) SetContextualDisplayingEnabled(arg0 bool)
SetContextualDisplayingEnabled mocks base method.
func (*MockLogger) SetDisplayLevel ¶
func (m *MockLogger) SetDisplayLevel(arg0 Level)
SetDisplayLevel mocks base method.
func (*MockLogger) SetDisplayingEnabled ¶
func (m *MockLogger) SetDisplayingEnabled(arg0 bool)
SetDisplayingEnabled mocks base method.
func (*MockLogger) SetLogLevel ¶
func (m *MockLogger) SetLogLevel(arg0 Level)
SetLogLevel mocks base method.
func (*MockLogger) SetLoggingEnabled ¶
func (m *MockLogger) SetLoggingEnabled(arg0 bool)
SetLoggingEnabled mocks base method.
func (*MockLogger) SetPrefix ¶
func (m *MockLogger) SetPrefix(arg0 string)
SetPrefix mocks base method.
func (*MockLogger) Trace ¶
func (m *MockLogger) Trace(format string, args ...interface{})
Trace mocks base method.
func (*MockLogger) Verbo ¶
func (m *MockLogger) Verbo(format string, args ...interface{})
Verbo mocks base method.
func (*MockLogger) Warn ¶
func (m *MockLogger) Warn(format string, args ...interface{})
Warn mocks base method.
type MockLoggerMockRecorder ¶
type MockLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockLoggerMockRecorder is the mock recorder for MockLogger.
func (*MockLoggerMockRecorder) AssertDeferredNoError ¶
func (mr *MockLoggerMockRecorder) AssertDeferredNoError(f interface{}) *gomock.Call
AssertDeferredNoError indicates an expected call of AssertDeferredNoError.
func (*MockLoggerMockRecorder) AssertDeferredTrue ¶
func (mr *MockLoggerMockRecorder) AssertDeferredTrue(f, format interface{}, args ...interface{}) *gomock.Call
AssertDeferredTrue indicates an expected call of AssertDeferredTrue.
func (*MockLoggerMockRecorder) AssertNoError ¶
func (mr *MockLoggerMockRecorder) AssertNoError(err interface{}) *gomock.Call
AssertNoError indicates an expected call of AssertNoError.
func (*MockLoggerMockRecorder) AssertTrue ¶
func (mr *MockLoggerMockRecorder) AssertTrue(b, format interface{}, args ...interface{}) *gomock.Call
AssertTrue indicates an expected call of AssertTrue.
func (*MockLoggerMockRecorder) Debug ¶
func (mr *MockLoggerMockRecorder) Debug(format interface{}, args ...interface{}) *gomock.Call
Debug indicates an expected call of Debug.
func (*MockLoggerMockRecorder) Error ¶
func (mr *MockLoggerMockRecorder) Error(format interface{}, args ...interface{}) *gomock.Call
Error indicates an expected call of Error.
func (*MockLoggerMockRecorder) Fatal ¶
func (mr *MockLoggerMockRecorder) Fatal(format interface{}, args ...interface{}) *gomock.Call
Fatal indicates an expected call of Fatal.
func (*MockLoggerMockRecorder) GetDisplayLevel ¶
func (mr *MockLoggerMockRecorder) GetDisplayLevel() *gomock.Call
GetDisplayLevel indicates an expected call of GetDisplayLevel.
func (*MockLoggerMockRecorder) GetLogLevel ¶
func (mr *MockLoggerMockRecorder) GetLogLevel() *gomock.Call
GetLogLevel indicates an expected call of GetLogLevel.
func (*MockLoggerMockRecorder) Info ¶
func (mr *MockLoggerMockRecorder) Info(format interface{}, args ...interface{}) *gomock.Call
Info indicates an expected call of Info.
func (*MockLoggerMockRecorder) RecoverAndExit ¶
func (mr *MockLoggerMockRecorder) RecoverAndExit(f, exit interface{}) *gomock.Call
RecoverAndExit indicates an expected call of RecoverAndExit.
func (*MockLoggerMockRecorder) RecoverAndPanic ¶
func (mr *MockLoggerMockRecorder) RecoverAndPanic(f interface{}) *gomock.Call
RecoverAndPanic indicates an expected call of RecoverAndPanic.
func (*MockLoggerMockRecorder) SetContextualDisplayingEnabled ¶
func (mr *MockLoggerMockRecorder) SetContextualDisplayingEnabled(arg0 interface{}) *gomock.Call
SetContextualDisplayingEnabled indicates an expected call of SetContextualDisplayingEnabled.
func (*MockLoggerMockRecorder) SetDisplayLevel ¶
func (mr *MockLoggerMockRecorder) SetDisplayLevel(arg0 interface{}) *gomock.Call
SetDisplayLevel indicates an expected call of SetDisplayLevel.
func (*MockLoggerMockRecorder) SetDisplayingEnabled ¶
func (mr *MockLoggerMockRecorder) SetDisplayingEnabled(arg0 interface{}) *gomock.Call
SetDisplayingEnabled indicates an expected call of SetDisplayingEnabled.
func (*MockLoggerMockRecorder) SetLogLevel ¶
func (mr *MockLoggerMockRecorder) SetLogLevel(arg0 interface{}) *gomock.Call
SetLogLevel indicates an expected call of SetLogLevel.
func (*MockLoggerMockRecorder) SetLoggingEnabled ¶
func (mr *MockLoggerMockRecorder) SetLoggingEnabled(arg0 interface{}) *gomock.Call
SetLoggingEnabled indicates an expected call of SetLoggingEnabled.
func (*MockLoggerMockRecorder) SetPrefix ¶
func (mr *MockLoggerMockRecorder) SetPrefix(arg0 interface{}) *gomock.Call
SetPrefix indicates an expected call of SetPrefix.
func (*MockLoggerMockRecorder) Stop ¶
func (mr *MockLoggerMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockLoggerMockRecorder) StopOnPanic ¶
func (mr *MockLoggerMockRecorder) StopOnPanic() *gomock.Call
StopOnPanic indicates an expected call of StopOnPanic.
func (*MockLoggerMockRecorder) Trace ¶
func (mr *MockLoggerMockRecorder) Trace(format interface{}, args ...interface{}) *gomock.Call
Trace indicates an expected call of Trace.
func (*MockLoggerMockRecorder) Verbo ¶
func (mr *MockLoggerMockRecorder) Verbo(format interface{}, args ...interface{}) *gomock.Call
Verbo indicates an expected call of Verbo.
func (*MockLoggerMockRecorder) Warn ¶
func (mr *MockLoggerMockRecorder) Warn(format interface{}, args ...interface{}) *gomock.Call
Warn indicates an expected call of Warn.
func (*MockLoggerMockRecorder) Write ¶
func (mr *MockLoggerMockRecorder) Write(p interface{}) *gomock.Call
Write indicates an expected call of Write.
type MockRotatingWriter ¶
type MockRotatingWriter struct {
// contains filtered or unexported fields
}
MockRotatingWriter is a mock of RotatingWriter interface.
func NewMockRotatingWriter ¶
func NewMockRotatingWriter(ctrl *gomock.Controller) *MockRotatingWriter
NewMockRotatingWriter creates a new mock instance.
func (*MockRotatingWriter) Close ¶
func (m *MockRotatingWriter) Close() error
Close mocks base method.
func (*MockRotatingWriter) EXPECT ¶
func (m *MockRotatingWriter) EXPECT() *MockRotatingWriterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRotatingWriter) Flush ¶
func (m *MockRotatingWriter) Flush() error
Flush mocks base method.
func (*MockRotatingWriter) Initialize ¶
func (m *MockRotatingWriter) Initialize(arg0 Config) (int, error)
Initialize mocks base method.
func (*MockRotatingWriter) Rotate ¶
func (m *MockRotatingWriter) Rotate() error
Rotate mocks base method.
func (*MockRotatingWriter) Write ¶
func (m *MockRotatingWriter) Write(b []byte) (int, error)
Write mocks base method.
func (*MockRotatingWriter) WriteString ¶
func (m *MockRotatingWriter) WriteString(s string) (int, error)
WriteString mocks base method.
type MockRotatingWriterMockRecorder ¶
type MockRotatingWriterMockRecorder struct {
// contains filtered or unexported fields
}
MockRotatingWriterMockRecorder is the mock recorder for MockRotatingWriter.
func (*MockRotatingWriterMockRecorder) Close ¶
func (mr *MockRotatingWriterMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockRotatingWriterMockRecorder) Flush ¶
func (mr *MockRotatingWriterMockRecorder) Flush() *gomock.Call
Flush indicates an expected call of Flush.
func (*MockRotatingWriterMockRecorder) Initialize ¶
func (mr *MockRotatingWriterMockRecorder) Initialize(arg0 interface{}) *gomock.Call
Initialize indicates an expected call of Initialize.
func (*MockRotatingWriterMockRecorder) Rotate ¶
func (mr *MockRotatingWriterMockRecorder) Rotate() *gomock.Call
Rotate indicates an expected call of Rotate.
func (*MockRotatingWriterMockRecorder) Write ¶
func (mr *MockRotatingWriterMockRecorder) Write(b interface{}) *gomock.Call
Write indicates an expected call of Write.
func (*MockRotatingWriterMockRecorder) WriteString ¶
func (mr *MockRotatingWriterMockRecorder) WriteString(s interface{}) *gomock.Call
WriteString indicates an expected call of WriteString.
type NoIOWriter ¶
type NoIOWriter struct{}
NoIOWriter is a mock Writer that does not write to any underlying source
func (NoIOWriter) Close ¶
func (NoIOWriter) Close() error
func (NoIOWriter) Flush ¶
func (NoIOWriter) Flush() error
func (NoIOWriter) Initialize ¶
func (NoIOWriter) Initialize(Config) (int, error)
func (NoIOWriter) Rotate ¶
func (NoIOWriter) Rotate() error
func (NoIOWriter) WriteString ¶
func (NoIOWriter) WriteString(s string) (int, error)
type NoLog ¶
type NoLog struct{}
func (NoLog) AssertDeferredNoError ¶
func (NoLog) AssertDeferredTrue ¶
func (NoLog) AssertNoError ¶
func (NoLog) AssertTrue ¶
func (NoLog) GetDisplayLevel ¶
func (NoLog) GetLogLevel ¶
func (NoLog) RecoverAndExit ¶
func (NoLog) RecoverAndExit(f, exit func())
func (NoLog) RecoverAndPanic ¶
func (NoLog) RecoverAndPanic(f func())
func (NoLog) SetContextualDisplayingEnabled ¶
func (NoLog) SetDisplayLevel ¶
func (NoLog) SetDisplayingEnabled ¶
func (NoLog) SetLogLevel ¶
func (NoLog) SetLoggingEnabled ¶
func (NoLog) StopOnPanic ¶
func (NoLog) StopOnPanic()
type RotatingWriter ¶
type RotatingWriter interface { // Creates the log file if it doesn't exist or resume writing to it if it does Initialize(Config) (int, error) // Flushes the writer Flush() error // Writes [b] to the log file Write(b []byte) (int, error) // Writes [s] to the log file WriteString(s string) (int, error) // Closes the log file Close() error // Rotates the log files. Always keeps the current log in the same file. // Rotated log files are stored as by appending an integer to the log file name, // from 1 to the RotationSize defined in the configuration. 1 being the most // recently rotated log file. Rotate() error }
RotatingWriter allows for rotating a stream writer
type Stacktrace ¶
type Stacktrace struct {
Global bool
}
Stacktrace can print the current stacktrace
func (Stacktrace) String ¶
func (st Stacktrace) String() string