RestLink 2.2.0
Powerfull Rest Client for Qt
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RestLink::LogRequestInterceptor Class Reference

Helper class to create a simple logger for RestLink requests. More...

#include <abstractrequestinterceptor.h>

Inherits RestLink::AbstractRequestInterceptor.

Public Member Functions

 LogRequestInterceptor (const char *category, QtMsgType enableForLevel=QtDebugMsg)
 Constructs the interceptor with a given logging category and level.
 
 LogRequestInterceptor (QLoggingCategory *category)
 Constructs the interceptor using an existing QLoggingCategory pointer.
 
 ~LogRequestInterceptor ()
 Destructor for LogRequestInterceptor. Deletes the QLoggingCategory if it was created by this interceptor.
 
void intercept (AbstractRequestHandler::Method method, Request &request, Body &body) override
 Logs the HTTP method and request URL.
 

Detailed Description

Helper class to create a simple logger for RestLink requests.

Constructor & Destructor Documentation

◆ LogRequestInterceptor() [1/2]

RestLink::LogRequestInterceptor::LogRequestInterceptor ( const char *  category,
QtMsgType  enableForLevel = QtDebugMsg 
)

Constructs the interceptor with a given logging category and level.

Parameters
categoryThe logging category name (e.g., "restlink.request").
enableForLevelThe minimum log level for which logging is enabled.

◆ LogRequestInterceptor() [2/2]

RestLink::LogRequestInterceptor::LogRequestInterceptor ( QLoggingCategory *  category)

Constructs the interceptor using an existing QLoggingCategory pointer.

Parameters
categoryPointer to an existing QLoggingCategory used for logging. Ownership is not transferred; the interceptor will not delete it.

◆ ~LogRequestInterceptor()

RestLink::LogRequestInterceptor::~LogRequestInterceptor ( )

Destructor for LogRequestInterceptor. Deletes the QLoggingCategory if it was created by this interceptor.

Member Function Documentation

◆ intercept()

void RestLink::LogRequestInterceptor::intercept ( AbstractRequestHandler::Method  method,
Request request,
Body body 
)
overridevirtual

Logs the HTTP method and request URL.

Sensitive data such as api tokens will never be shown.

Parameters
methodHTTP method used.
requestRequest to log.
bodyRequest body.

Implements RestLink::AbstractRequestInterceptor.