Documentation ¶
Overview ¶
Package log is a generated GoMock package.
Index ¶
- func BuildZapLogger(cfg Config) *zap.Logger
- func CapturePanic(logger Logger, retError *error)
- func NewCLILogger() *zapLogger
- func NewLazyLogger(logger Logger, tagFn func() []tag.Tag) *lazyLogger
- func NewNoopLogger() *noopLogger
- func NewReplayLogger(logger Logger, ctx workflow.Context, enableLogInReplay bool) *replayLogger
- func NewSlogLogger(logger Logger) *slog.Logger
- func NewTestLogger() *zapLogger
- func NewThrottledLogger(logger Logger, rps quotas.RateFn) *throttledLogger
- func NewZapLogger(zl *zap.Logger) *zapLogger
- type Config
- type Logger
- type MockLogger
- func (m *MockLogger) DPanic(msg string, tags ...tag.Tag)
- func (m *MockLogger) Debug(msg string, tags ...tag.Tag)
- func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
- func (m *MockLogger) Error(msg string, tags ...tag.Tag)
- func (m *MockLogger) Fatal(msg string, tags ...tag.Tag)
- func (m *MockLogger) Info(msg string, tags ...tag.Tag)
- func (m *MockLogger) Panic(msg string, tags ...tag.Tag)
- func (m *MockLogger) Warn(msg string, tags ...tag.Tag)
- type MockLoggerMockRecorder
- func (mr *MockLoggerMockRecorder) DPanic(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Debug(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Error(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Fatal(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Info(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Panic(msg any, tags ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Warn(msg any, tags ...any) *gomock.Call
- type MockSkipLogger
- type MockSkipLoggerMockRecorder
- type MockWithLogger
- type MockWithLoggerMockRecorder
- type SLogWrapper
- type SdkLogger
- func (l *SdkLogger) Debug(msg string, keyvals ...interface{})
- func (l *SdkLogger) Error(msg string, keyvals ...interface{})
- func (l *SdkLogger) Info(msg string, keyvals ...interface{})
- func (l *SdkLogger) Warn(msg string, keyvals ...interface{})
- func (l *SdkLogger) With(keyvals ...interface{}) log.Logger
- type SkipLogger
- type SnTaggedLogger
- type ThrottledLogger
- type WithLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildZapLogger ¶ added in v1.5.7
BuildZapLogger builds and returns a new zap.Logger for this logging configuration
func CapturePanic ¶
CapturePanic is used to capture panic, it will log the panic and also return the error through pointer. If the panic value is not error then a default error is returned We have to use pointer is because in golang: "recover return nil if was not called directly by a deferred function." And we have to set the returned error otherwise our handler will return nil as error which is incorrect
func NewCLILogger ¶ added in v1.10.0
func NewCLILogger() *zapLogger
NewCLILogger returns a logger at debug level and log into STDERR for logging from within CLI tools
func NewLazyLogger ¶ added in v1.17.0
func NewNoopLogger ¶ added in v1.5.7
func NewNoopLogger() *noopLogger
NewNoopLogger return a noopLogger
func NewReplayLogger ¶ added in v1.5.7
NewReplayLogger creates a logger which is aware of Temporal replay mode
func NewSlogLogger ¶ added in v1.23.0
NewSlogLogger creates an slog.Logger from a given logger.
func NewTestLogger ¶ added in v1.10.0
func NewTestLogger() *zapLogger
NewTestLogger returns a logger for tests
func NewThrottledLogger ¶ added in v1.5.7
NewThrottledLogger returns an implementation of logger that throttles the log messages being emitted. The underlying implementation uses a token bucket rate limiter and stops emitting logs once the bucket runs out of tokens
Fatal/Panic logs are always emitted without any throttling
func NewZapLogger ¶ added in v1.5.7
NewZapLogger returns a new zap based logger from zap.Logger
Types ¶
type Config ¶ added in v1.5.7
type Config struct { // Stdout is true if the output needs to goto standard out; default is stderr Stdout bool `yaml:"stdout"` // Level is the desired log level; see colocated zap_logger.go::parseZapLevel() Level string `yaml:"level"` // OutputFile is the path to the log output file OutputFile string `yaml:"outputFile"` // Format determines the format of each log file printed to the output. // Acceptable values are "json" or "console". The default is "json". // Use "console" if you want stack traces to appear on multiple lines. Format string `yaml:"format"` // Development determines whether the logger is run in Development (== Test) or in // Production mode. Default is Production. Production-stage disables panics from // DPanic logging. Development bool `yaml:"development"` }
Config contains the config items for logger
type Logger ¶
type Logger interface { Debug(msg string, tags ...tag.Tag) Info(msg string, tags ...tag.Tag) Warn(msg string, tags ...tag.Tag) Error(msg string, tags ...tag.Tag) DPanic(msg string, tags ...tag.Tag) Panic(msg string, tags ...tag.Tag) Fatal(msg string, tags ...tag.Tag) }
Logger is the logging interface. Usage example:
logger.Info("hello world", tag.WorkflowNextEventID(123), tag.WorkflowActionWorkflowStarted, tag.WorkflowNamespaceID("test-namespace-id")), ) Note: msg should be static, do not use fmt.Sprintf() for msg. Anything dynamic should be tagged.
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock of Logger interface.
func NewMockLogger ¶ added in v1.5.7
func NewMockLogger(ctrl *gomock.Controller) *MockLogger
NewMockLogger creates a new mock instance.
func (*MockLogger) DPanic ¶ added in v1.20.0
func (m *MockLogger) DPanic(msg string, tags ...tag.Tag)
DPanic mocks base method.
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(msg string, tags ...tag.Tag)
Debug mocks base method.
func (*MockLogger) EXPECT ¶ added in v1.5.7
func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLogger) Error ¶
func (m *MockLogger) Error(msg string, tags ...tag.Tag)
Error mocks base method.
func (*MockLogger) Fatal ¶
func (m *MockLogger) Fatal(msg string, tags ...tag.Tag)
Fatal mocks base method.
func (*MockLogger) Info ¶
func (m *MockLogger) Info(msg string, tags ...tag.Tag)
Info mocks base method.
type MockLoggerMockRecorder ¶ added in v1.5.7
type MockLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockLoggerMockRecorder is the mock recorder for MockLogger.
func (*MockLoggerMockRecorder) DPanic ¶ added in v1.20.0
func (mr *MockLoggerMockRecorder) DPanic(msg any, tags ...any) *gomock.Call
DPanic indicates an expected call of DPanic.
func (*MockLoggerMockRecorder) Debug ¶ added in v1.5.7
func (mr *MockLoggerMockRecorder) Debug(msg any, tags ...any) *gomock.Call
Debug indicates an expected call of Debug.
func (*MockLoggerMockRecorder) Error ¶ added in v1.5.7
func (mr *MockLoggerMockRecorder) Error(msg any, tags ...any) *gomock.Call
Error indicates an expected call of Error.
func (*MockLoggerMockRecorder) Fatal ¶ added in v1.5.7
func (mr *MockLoggerMockRecorder) Fatal(msg any, tags ...any) *gomock.Call
Fatal indicates an expected call of Fatal.
func (*MockLoggerMockRecorder) Info ¶ added in v1.5.7
func (mr *MockLoggerMockRecorder) Info(msg any, tags ...any) *gomock.Call
Info indicates an expected call of Info.
type MockSkipLogger ¶ added in v1.5.7
type MockSkipLogger struct {
// contains filtered or unexported fields
}
MockSkipLogger is a mock of SkipLogger interface.
func NewMockSkipLogger ¶ added in v1.5.7
func NewMockSkipLogger(ctrl *gomock.Controller) *MockSkipLogger
NewMockSkipLogger creates a new mock instance.
func (*MockSkipLogger) EXPECT ¶ added in v1.5.7
func (m *MockSkipLogger) EXPECT() *MockSkipLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSkipLogger) Skip ¶ added in v1.5.7
func (m *MockSkipLogger) Skip(extraSkip int) Logger
Skip mocks base method.
type MockSkipLoggerMockRecorder ¶ added in v1.5.7
type MockSkipLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockSkipLoggerMockRecorder is the mock recorder for MockSkipLogger.
type MockWithLogger ¶ added in v1.5.7
type MockWithLogger struct {
// contains filtered or unexported fields
}
MockWithLogger is a mock of WithLogger interface.
func NewMockWithLogger ¶ added in v1.5.7
func NewMockWithLogger(ctrl *gomock.Controller) *MockWithLogger
NewMockWithLogger creates a new mock instance.
func (*MockWithLogger) EXPECT ¶ added in v1.5.7
func (m *MockWithLogger) EXPECT() *MockWithLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockWithLoggerMockRecorder ¶ added in v1.5.7
type MockWithLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockWithLoggerMockRecorder is the mock recorder for MockWithLogger.
type SLogWrapper ¶ added in v1.26.2
SLogWrapper allows extracting an underlying slog logger.
type SdkLogger ¶ added in v1.5.7
type SdkLogger struct {
// contains filtered or unexported fields
}
func NewSdkLogger ¶ added in v1.5.7
type SkipLogger ¶ added in v1.5.7
If logger implements SkipLogger then Skip method will be called and extraSkip parameter will have number of extra stack trace frames to skip (useful to log caller func file/line).
type SnTaggedLogger ¶ added in v1.19.0
type SnTaggedLogger Logger
Special logger types for use with fx
type ThrottledLogger ¶ added in v1.19.0
type ThrottledLogger Logger
type WithLogger ¶ added in v1.5.7
Implement WithLogger interface with With method which should return new instance of logger with prepended tags. If WithLogger is not implemented on logger, internal (not very efficient) preppender is used. Create prepended logger example:
logger = log.With( logger, tag.WorkflowNextEventID(123), tag.WorkflowActionWorkflowStarted, tag.WorkflowNamespaceID("test-namespace-id")) ... logger.Info("hello world")