mocklogger

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

mocklogger/mocklogger.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockLogger

type MockLogger struct {
	mock.Mock
	*zap.Logger
	// contains filtered or unexported fields
}

MockLogger is a mock type for the Logger interface, embedding a *zap.Logger to satisfy the type requirement.

func NewMockLogger

func NewMockLogger() *MockLogger

NewMockLogger creates a new instance of MockLogger with an embedded no-op *zap.Logger.

func (*MockLogger) Debug

func (m *MockLogger) Debug(msg string, fields ...zap.Field)

Debug logs a message at the Debug level.

func (*MockLogger) Error

func (m *MockLogger) Error(msg string, fields ...zap.Field) error

Error logs a message at the Error level and returns an error.

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(msg string, fields ...zap.Field)

Fatal logs a message at the Fatal level and then calls os.Exit(1).

func (*MockLogger) GetLogLevel

func (m *MockLogger) GetLogLevel() logger.LogLevel

GetLogLevel mocks the GetLogLevel method of the Logger interface.

func (*MockLogger) Info

func (m *MockLogger) Info(msg string, fields ...zap.Field)

Info logs a message at the Info level.

func (*MockLogger) LogAuthTokenError

func (m *MockLogger) LogAuthTokenError(event string, method string, url string, statusCode int, err error)

Example for LogAuthTokenError:

func (*MockLogger) LogCookies

func (m *MockLogger) LogCookies(direction string, obj interface{}, method, url string)

LogCookies logs information about cookies.

func (*MockLogger) LogError

func (m *MockLogger) LogError(event string, method string, url string, statusCode int, serverStatusMessage string, err error, rawResponse string)

LogError logs an error event.

func (*MockLogger) LogRateLimiting

func (m *MockLogger) LogRateLimiting(event string, method string, url string, retryAfter string, waitDuration time.Duration)

LogRateLimiting logs rate limiting events.

func (*MockLogger) LogRequestEnd

func (m *MockLogger) LogRequestEnd(event string, method string, url string, statusCode int, duration time.Duration)

LogRequestEnd logs the end of an HTTP request.

func (*MockLogger) LogRequestStart

func (m *MockLogger) LogRequestStart(event string, requestID string, userID string, method string, url string, headers map[string][]string)

LogRequestStart logs the start of an HTTP request.

func (*MockLogger) LogResponse

func (m *MockLogger) LogResponse(event string, method string, url string, statusCode int, responseBody string, responseHeaders map[string][]string, duration time.Duration)

LogResponse logs HTTP responses.

func (*MockLogger) LogRetryAttempt

func (m *MockLogger) LogRetryAttempt(event string, method string, url string, attempt int, reason string, waitDuration time.Duration, err error)

LogRetryAttempt logs a retry attempt.

func (*MockLogger) Panic

func (m *MockLogger) Panic(msg string, fields ...zap.Field)

Panic logs a message at the Panic level and then panics.

func (*MockLogger) SetLevel

func (m *MockLogger) SetLevel(level logger.LogLevel)

SetLevel sets the logging level of the MockLogger. This controls the verbosity of the logger, allowing it to filter out logs below the set level.

func (*MockLogger) Warn

func (m *MockLogger) Warn(msg string, fields ...zap.Field)

Warn logs a message at the Warn level.

func (*MockLogger) With

func (m *MockLogger) With(fields ...zap.Field) logger.Logger

With adds contextual key-value pairs to the MockLogger and returns a new logger instance with this context. This is useful for adding common fields to all subsequent logs produced by the logger.

Jump to

Keyboard shortcuts

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