R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BLogger.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14// ----------------------------------------------------------------------
15// ----- R3BLogger -----
16// ----- Created 15/12/21 by J.L. Rodriguez-Sanchez -----
17// ----------------------------------------------------------------------
18
19#pragma once
20
21#include <cstdlib>
22#include <fstream>
23#include <iostream>
24#include <sstream>
25#include <string>
26
27#include <FairLogger.h>
28
29// NOLINTBEGIN
30class R3BLogger;
31
32class R3BLogger : public FairLogger
33{
34 public:
35#define R3BLOG(severity, x) \
36 if (true) \
37 { \
38 std::string fN(__FILE__); \
39 std::stringstream ss; \
40 ss << fN.substr(fN.find_last_of("/") + 1) << ":" << __LINE__ << ":" << __FUNCTION__ << "(): "; \
41 LOG(severity) << ss.str() << x; \
42 } \
43 else \
44 (void)0
45
46#define R3BLOG_IF(severity, condition, x) \
47 if (true) \
48 { \
49 std::string fNif(__FILE__); \
50 std::stringstream ssif; \
51 ssif << fNif.substr(fNif.find_last_of("/") + 1) << ":" << __LINE__ << ":" << __FUNCTION__ << "(): "; \
52 LOG_IF(severity, condition) << ssif.str() << x; \
53 } \
54 else \
55 (void)0
56
57 private:
58 R3BLogger();
59 ~R3BLogger();
60
61 public:
62 ClassDefOverride(R3BLogger, 0)
63};
64// NOLINTEND