Belle II Software  release-08-01-10
LogMethod.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/logging/Logger.h>
12 
13 #include <string>
14 
15 namespace Belle2 {
31  class LogMethod {
32 
33  public:
34 
43  LogMethod(const char* package, std::string function, std::string file, unsigned int line);
44 
46  ~LogMethod();
47 
48 
49  protected:
50 
51  private:
52 
53  const char* m_package;
54  std::string m_function;
55  std::string m_file;
56  unsigned int m_line;
58  };
59 
61 } // end namespace Belle2
62 
63 
71 #ifdef LOG_NO_B2METHOD
72 #define B2METHOD() _B2_DO_NOTHING
73 #else
74 #define B2METHOD() Belle2::LogMethod logMethod(PACKAGENAME(), FUNCTIONNAME(), __FILE__, __LINE__)
75 #endif
The LogMethod class.
Definition: LogMethod.h:31
~LogMethod()
The LogMethod destructor.
Definition: LogMethod.cc: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
LogMethod(const char *package, std::string function, std::string file, unsigned int line)
The LogMethod constructor.
Definition: LogMethod.cc:19
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
Abstract base class for different kinds of events.