Documentation ¶
Index ¶
- Constants
- type ConsoleLogger
- type Level
- type LoggerConfiguration
- type LoggerInterface
- type LoggerOptions
- func WithLevel(level Level) LoggerOptions
- func WithLogger(logger LoggerInterface) LoggerOptions
- func WithMaskSensitiveHeaders(maskSensitiveHeaders bool) LoggerOptions
- func WithRequestConfiguration(options ...RequestLoggerOptions) LoggerOptions
- func WithResponseConfiguration(options ...ResponseLoggerOptions) LoggerOptions
- type NullSdkLogger
- type RequestLoggerConfiguration
- type RequestLoggerOptions
- func WithExcludeRequestHeaders(excludeHeaders ...string) RequestLoggerOptions
- func WithIncludeQueryInPath(includeQueryInPath bool) RequestLoggerOptions
- func WithIncludeRequestHeaders(includeHeaders ...string) RequestLoggerOptions
- func WithRequestBody(logBody bool) RequestLoggerOptions
- func WithRequestHeaders(logHeaders bool) RequestLoggerOptions
- func WithWhitelistRequestHeaders(whitelistHeaders ...string) RequestLoggerOptions
- type ResponseLoggerConfiguration
- type ResponseLoggerOptions
- func WithExcludeResponseHeaders(excludeHeaders ...string) ResponseLoggerOptions
- func WithIncludeResponseHeaders(includeHeaders ...string) ResponseLoggerOptions
- func WithResponseBody(logBody bool) ResponseLoggerOptions
- func WithResponseHeaders(logHeaders bool) ResponseLoggerOptions
- func WithWhitelistResponseHeaders(whitelistHeaders ...string) ResponseLoggerOptions
- type SdkLogger
- type SdkLoggerInterface
Constants ¶
const CONTENT_LENGTH_HEADER = "content-length"
const CONTENT_TYPE_HEADER = "content-type"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct{}
ConsoleLogger represents a logger implementation that logs messages to the console.
type Level ¶
type Level string
Level is a string enum. An enum representing different log levels.
func (Level) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for Level. It customizes the JSON marshaling process for Level objects.
func (*Level) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Level. It customizes the JSON unmarshalling process for Level objects.
type LoggerConfiguration ¶
type LoggerConfiguration struct {
// contains filtered or unexported fields
}
LoggerConfiguration represents options for configuring logging behavior.
func NewLoggerConfiguration ¶
func NewLoggerConfiguration(options ...LoggerOptions) LoggerConfiguration
NewLoggerConfiguration creates default LoggingOptions with the provided options.
type LoggerInterface ¶
type LoggerInterface interface { // Log function provides a message string containing placeholders in the format '%{key}', // along with the log level and a map of parameters that can be replaced in the message. Log(level Level, message string, params map[string]any) }
LoggerInterface represents an interface for a generic logger.
type LoggerOptions ¶
type LoggerOptions func(*LoggerConfiguration)
LoggerOptions represents a function type that can be used to apply configuration to the LoggerOptions struct.
func WithLevel ¶
func WithLevel(level Level) LoggerOptions
WithLevel is an option that sets the LogLevel in the LoggingOptions.
func WithLogger ¶
func WithLogger(logger LoggerInterface) LoggerOptions
WithLogger is an option that sets the LoggerInterface in the LoggingOptions.
func WithMaskSensitiveHeaders ¶
func WithMaskSensitiveHeaders(maskSensitiveHeaders bool) LoggerOptions
WithMaskSensitiveHeaders is an option that enable to mask Sensitive Headers in the LoggingOptions.
func WithRequestConfiguration ¶
func WithRequestConfiguration(options ...RequestLoggerOptions) LoggerOptions
WithRequestConfiguration is an option that sets that enable to log Request in the LoggingOptions.
func WithResponseConfiguration ¶
func WithResponseConfiguration(options ...ResponseLoggerOptions) LoggerOptions
WithResponseConfiguration is an option that sets that enable to log Response in the LoggingOptions.
type NullSdkLogger ¶
type NullSdkLogger struct{}
NullSdkLogger represents implementation for SdkLoggerInterface, implementing methods to log HTTP requests and responses.
func (NullSdkLogger) LogRequest ¶
func (a NullSdkLogger) LogRequest(_request *http.Request)
LogRequest request Logs an HTTP request.
func (NullSdkLogger) LogResponse ¶
func (a NullSdkLogger) LogResponse(_response *http.Response)
LogResponse Logs an HTTP response.
type RequestLoggerConfiguration ¶
type RequestLoggerConfiguration struct {
// contains filtered or unexported fields
}
RequestLoggerConfiguration represents options for logging HTTP request details.
func NewHttpRequestLoggerConfiguration ¶
func NewHttpRequestLoggerConfiguration(options ...RequestLoggerOptions) RequestLoggerConfiguration
NewHttpRequestLoggerConfiguration creates default RequestLoggerConfiguration with the provided options.
type RequestLoggerOptions ¶
type RequestLoggerOptions func(*RequestLoggerConfiguration)
RequestLoggerOptions represents a function type that can be used to apply configuration to the RequestLoggerOptions struct.
func WithExcludeRequestHeaders ¶
func WithExcludeRequestHeaders(excludeHeaders ...string) RequestLoggerOptions
WithExcludeRequestHeaders is an option that sets the Headers To Exclude in the LoggingOptions.
func WithIncludeQueryInPath ¶
func WithIncludeQueryInPath(includeQueryInPath bool) RequestLoggerOptions
WithIncludeQueryInPath is an option that enable include Query InPath in the LoggingOptions.
func WithIncludeRequestHeaders ¶
func WithIncludeRequestHeaders(includeHeaders ...string) RequestLoggerOptions
WithIncludeRequestHeaders is an option that sets the Headers To Include in the LoggingOptions.
func WithRequestBody ¶
func WithRequestBody(logBody bool) RequestLoggerOptions
WithRequestBody is an option that sets that enable to log body in the LoggingOptions.
func WithRequestHeaders ¶
func WithRequestHeaders(logHeaders bool) RequestLoggerOptions
WithRequestHeaders is an option that sets that enable to log headers in the LoggingOptions.
func WithWhitelistRequestHeaders ¶
func WithWhitelistRequestHeaders(whitelistHeaders ...string) RequestLoggerOptions
WithWhitelistRequestHeaders is an option that sets the Headers To Whitelist in the LoggingOptions.
type ResponseLoggerConfiguration ¶
type ResponseLoggerConfiguration struct {
// contains filtered or unexported fields
}
ResponseLoggerConfiguration represents options for logging HTTP message details.
func NewResponseLoggerConfiguration ¶
func NewResponseLoggerConfiguration(options ...ResponseLoggerOptions) ResponseLoggerConfiguration
NewResponseLoggerConfiguration creates default ResponseLoggerConfiguration with the provided options.
type ResponseLoggerOptions ¶
type ResponseLoggerOptions func(*ResponseLoggerConfiguration)
ResponseLoggerOptions represents a function type that can be used to apply configuration to the ResponseLoggerOptions struct.
func WithExcludeResponseHeaders ¶
func WithExcludeResponseHeaders(excludeHeaders ...string) ResponseLoggerOptions
WithExcludeResponseHeaders is an option that sets the Headers To Exclude in the LoggingOptions.
func WithIncludeResponseHeaders ¶
func WithIncludeResponseHeaders(includeHeaders ...string) ResponseLoggerOptions
WithIncludeResponseHeaders is an option that sets the Headers To Include in the LoggingOptions.
func WithResponseBody ¶
func WithResponseBody(logBody bool) ResponseLoggerOptions
WithResponseBody is an option that sets that enable to log body in the LoggingOptions.
func WithResponseHeaders ¶
func WithResponseHeaders(logHeaders bool) ResponseLoggerOptions
WithResponseHeaders is an option that sets that enable to log headers in the LoggingOptions.
func WithWhitelistResponseHeaders ¶
func WithWhitelistResponseHeaders(whitelistHeaders ...string) ResponseLoggerOptions
WithWhitelistResponseHeaders is an option that sets the Headers To Whitelist in the LoggingOptions.
type SdkLogger ¶
type SdkLogger struct {
// contains filtered or unexported fields
}
SdkLogger represents implementation for SdkLoggerInterface, providing methods to log HTTP requests and responses.
func (*SdkLogger) LogRequest ¶
LogRequest request Logs an HTTP request.
func (*SdkLogger) LogResponse ¶
LogResponse Logs an HTTP response.
type SdkLoggerInterface ¶
type SdkLoggerInterface interface { // LogRequest logs the details of an HTTP request. LogRequest(request *http.Request) // LogResponse logs the details of an HTTP response. LogResponse(response *http.Response) }
SdkLoggerInterface Represents an interface for logging API requests and responses.
func NewSdkLogger ¶
func NewSdkLogger(loggingOpt LoggerConfiguration) SdkLoggerInterface
NewSdkLogger Constructs a new instance of SdkLogger or NullSdkLogger.