Belle II Software development
LogMessage::TextHasher Struct Reference

Helper struct to hash and compare messages only by log level and message content. More...

#include <LogMessage.h>

Public Member Functions

std::size_t operator() (const LogMessage &msg) const
 Return a hash for the given log message just based on the log level and the message.
 
bool operator() (const LogMessage &lhs, const LogMessage &rhs) const
 Check if log level and message text are identical.
 

Detailed Description

Helper struct to hash and compare messages only by log level and message content.

This explicitly ignores other information like log variables and module/package/file/line information to just combine messages which will look similar to the user.

Definition at line 143 of file LogMessage.h.

Member Function Documentation

◆ operator()() [1/2]

bool operator() ( const LogMessage lhs,
const LogMessage rhs 
) const
inline

Check if log level and message text are identical.

Definition at line 150 of file LogMessage.h.

151 {
152 return (lhs.m_logLevel == rhs.m_logLevel) &&
153 (lhs.m_message.getMessage() == rhs.m_message.getMessage());
154 }

◆ operator()() [2/2]

std::size_t operator() ( const LogMessage msg) const
inline

Return a hash for the given log message just based on the log level and the message.

Definition at line 145 of file LogMessage.h.

146 {
147 return msg.m_logLevel ^ std::hash<std::string>()(msg.m_message.getMessage());
148 }

The documentation for this struct was generated from the following file: