Belle II Software  release-08-01-10
LogMethod Class Reference

The LogMethod class. More...

#include <LogMethod.h>

Collaboration diagram for LogMethod:

Public Member Functions

 LogMethod (const char *package, std::string function, std::string file, unsigned int line)
 The LogMethod constructor. More...
 
 ~LogMethod ()
 The LogMethod destructor.
 

Private Attributes

const char * m_package
 The package name where the message was sent from.
 
std::string m_function
 The function name where the message was sent from.
 
std::string m_file
 The file name where the message was sent from.
 
unsigned int m_line
 The line number in the source code where the message was sent from.
 

Detailed Description

The LogMethod class.

This class allows the logging of the entering and leaving point of a method. Therefore an object of this class is created on the stack, which logs a message at the moment it is created and destroyed. In addition, it logs a message if there are any uncaught exceptions pending at the time the object is destroyed on the stack. This allows to identify methods which were terminated due to a thrown exception.

Definition at line 31 of file LogMethod.h.

Constructor & Destructor Documentation

◆ LogMethod()

LogMethod ( const char *  package,
std::string  function,
std::string  file,
unsigned int  line 
)

The LogMethod constructor.

Parameters
packageThe package name where the message was sent from.
functionThe function name where the message was sent from.
fileThe file name where the message was sent from.
lineThe line number in the source code where the message was sent from.

Definition at line 19 of file LogMethod.cc.

19  : m_package(package),
20  m_function(std::move(function)), m_file(std::move(file)), m_line(line)
21 {
22  //Send message for entering the method
23  if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Info)) {
24  string messageText = "--> Entering method '" + m_function + "'";
26  }
27 }
@ c_Info
Info: for informational messages, e.g.
Definition: LogConfig.h:27
The LogMessage class.
Definition: LogMessage.h:29
unsigned int m_line
The line number in the source code where the message was sent from.
Definition: LogMethod.h:56
const char * m_package
The package name where the message was sent from.
Definition: LogMethod.h:53
std::string m_file
The file name where the message was sent from.
Definition: LogMethod.h:55
std::string m_function
The function name where the message was sent from.
Definition: LogMethod.h:54
bool sendMessage(LogMessage &&message)
Sends a log message using the log connection object.
Definition: LogSystem.cc:69
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31

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