Documentation
¶
Overview ¶
Package logger provides comprehensive logging capabilities for the AhaSend CLI.
This package implements multi-level logging with security-aware features:
- Structured logging using logrus with JSON formatting
- HTTP transport logging for API debugging (request/response details)
- Security-aware log sanitization (API keys and sensitive headers redacted)
- Two-level logging: --verbose (API summaries) and --debug (full details)
- Configuration operation logging for troubleshooting
- Performance monitoring with request timing and metrics
- Color-coded output with --no-color flag support
The logger automatically detects and redacts sensitive information while providing comprehensive debugging information for development and support.
Index ¶
- func APICall(method, endpoint string, duration time.Duration)
- func APIError(method, endpoint string, statusCode int, err error, duration time.Duration)
- func ConfigOperation(operation, profile string, details map[string]interface{})
- func Debug(args ...interface{})
- func Error(args ...interface{})
- func HTTPRequest(method, url string, headers http.Header, body interface{})
- func HTTPResponse(statusCode int, status string, headers http.Header, body interface{}, ...)
- func Info(args ...interface{})
- func Initialize(cmd *cobra.Command)
- func RateLimitHit(waitTime time.Duration)
- func RetryAttempt(attempt int, maxAttempts int, err error, delay time.Duration)
- func Warn(args ...interface{})
- type HTTPTransport
- type Logger
- func (l *Logger) APICall(method, endpoint string, duration time.Duration)
- func (l *Logger) APIError(method, endpoint string, statusCode int, err error, duration time.Duration)
- func (l *Logger) ConfigOperation(operation, profile string, details map[string]interface{})
- func (l *Logger) HTTPRequest(method, url string, headers http.Header, body interface{})
- func (l *Logger) HTTPResponse(statusCode int, status string, headers http.Header, body interface{}, ...)
- func (l *Logger) IsDebugEnabled() bool
- func (l *Logger) IsVerboseEnabled() bool
- func (l *Logger) RateLimitHit(waitTime time.Duration)
- func (l *Logger) RetryAttempt(attempt int, maxAttempts int, err error, delay time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigOperation ¶
func HTTPRequest ¶
func HTTPResponse ¶
func Initialize ¶
Initialize sets up the global logger based on CLI flags
func RateLimitHit ¶
Types ¶
type HTTPTransport ¶
type HTTPTransport struct {
// contains filtered or unexported fields
}
HTTPTransport is a custom RoundTripper that logs HTTP requests and responses
func NewHTTPTransport ¶
func NewHTTPTransport(transport http.RoundTripper, logger *Logger) *HTTPTransport
NewHTTPTransport creates a new HTTP transport with logging
type Logger ¶
Logger wraps logrus with CLI-specific functionality
func NewLoggerWithFormat ¶
NewLoggerWithFormat creates a new logger instance with JSON mode awareness
func (*Logger) APIError ¶
func (l *Logger) APIError(method, endpoint string, statusCode int, err error, duration time.Duration)
APIError logs API errors
func (*Logger) ConfigOperation ¶
ConfigOperation logs configuration operations
func (*Logger) HTTPRequest ¶
HTTPRequest logs HTTP request details
func (*Logger) HTTPResponse ¶
func (l *Logger) HTTPResponse(statusCode int, status string, headers http.Header, body interface{}, duration time.Duration)
HTTPResponse logs HTTP response details
func (*Logger) IsDebugEnabled ¶
IsDebugEnabled returns true if debug mode is enabled
func (*Logger) IsVerboseEnabled ¶
IsVerboseEnabled returns true if verbose mode is enabled
func (*Logger) RateLimitHit ¶
RateLimitHit logs when rate limiting is applied