MySQL 8.4.0
Source Code Documentation
Error_log_throttle Class Reference

#include <log.h>

Inheritance diagram for Error_log_throttle:
[legend]

Public Member Functions

 Error_log_throttle (ulong window_usecs, loglevel lvl, uint errcode, const char *subsystem, const char *msg)
 
bool flush ()
 Prepare and print a summary of suppressed lines to log. More...
 
bool log ()
 Top-level function. More...
 

Private Member Functions

void print_summary (ulong suppressed)
 Actually print the prepared summary to log. More...
 

Private Attributes

loglevel ll
 
uint err_code
 
const char * subsys
 

Additional Inherited Members

- Static Public Attributes inherited from Log_throttle
static const ulong LOG_THROTTLE_WINDOW_SIZE = 60000000
 We're rate-limiting messages per minute; 60,000,000 microsecs = 60s Debugging is less tedious with a window in the region of 5000000. More...
 
- Protected Member Functions inherited from Log_throttle
void new_window (ulonglong now)
 Start a new window. More...
 
bool inc_log_count (ulong rate)
 Increase count of logs we're handling. More...
 
bool in_window (ulonglong now) const
 Check whether we're still in the current window. More...
 
ulong prepare_summary (ulong rate)
 Prepare a summary of suppressed lines for logging. More...
 
 Log_throttle (ulong window_usecs, const char *msg)
 
- Protected Attributes inherited from Log_throttle
const char * summary_template
 Template for the summary line. More...
 

Constructor & Destructor Documentation

◆ Error_log_throttle()

Error_log_throttle::Error_log_throttle ( ulong  window_usecs,
loglevel  lvl,
uint  errcode,
const char *  subsystem,
const char *  msg 
)
inline
Parameters
window_usecs... in this many micro-seconds (see Log_throttle)
lvlseverity of the incident (error, warning, info)
errcodeMySQL error code (e.g. ER_STARTUP)
subsystemsubsystem tag, or nullptr for none
msguse this message template containing lu as only non-literal (for "number of suppressed events", see Log_throttle)

Member Function Documentation

◆ flush()

bool Error_log_throttle::flush ( )

Prepare and print a summary of suppressed lines to log.

(For now, slow query log.) The summary states the number of queries that were qualified for inclusion in the log, but were not printed because of the rate-limiting.

Return values
falseLogging was not suppressed, no summary needed.
trueLogging was suppressed; a summary was printed.

◆ log()

bool Error_log_throttle::log ( )

Top-level function.

Return values
trueLogging should be suppressed.
falseLogging should not be suppressed.

◆ print_summary()

void Error_log_throttle::print_summary ( ulong  suppressed)
inlineprivate

Actually print the prepared summary to log.

Member Data Documentation

◆ err_code

uint Error_log_throttle::err_code
private

◆ ll

loglevel Error_log_throttle::ll
private

◆ subsys

const char* Error_log_throttle::subsys
private

The documentation for this class was generated from the following files: