GooFit  v2.1.3
Log.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 
5 #include <fmt/format.h>
6 #include <goofit/Color.h>
7 
8 namespace GooFit {
9 
10 #define GOOFIT_INFO(...) \
11  { \
12  std::cout << GooFit::reset << GooFit::blue; \
13  fmt::print(__VA_ARGS__); \
14  std::cout << GooFit::reset << std::endl; \
15  }
16 #define GOOFIT_INFO_F(...) \
17  { \
18  std::cout << GooFit::reset << GooFit::blue; \
19  fmt::printf(__VA_ARGS__); \
20  std::cout << GooFit::reset << std::endl; \
21  }
22 #define GOOFIT_INFO_C(color, ...) \
23  { \
24  std::cout << GooFit::reset << color; \
25  fmt::print(__VA_ARGS__); \
26  std::cout << GooFit::reset << std::endl; \
27  }
28 #define GOOFIT_INFO_FC(color, ...) \
29  { \
30  std::cout << GooFit::reset << color; \
31  fmt::printf(__VA_ARGS__); \
32  std::cout << GooFit::reset << std::endl; \
33  }
34 #define GOOFIT_STATUS(...) \
35  { \
36  std::cout << GooFit::reset << GooFit::magenta; \
37  fmt::print(__VA_ARGS__); \
38  std::cout << GooFit::reset << std::endl; \
39  }
40 #define GOOFIT_STATUS_F(...) \
41  { \
42  std::cout << GooFit::reset << GooFit::magenta; \
43  fmt::printf(__VA_ARGS__); \
44  std::cout << GooFit::reset << std::endl; \
45  }
46 #define GOOFIT_WARN(...) \
47  { \
48  std::cout << GooFit::reset << GooFit::yellow << GooFit::bold; \
49  fmt::print(__VA_ARGS__); \
50  std::cout << GooFit::reset << std::endl; \
51  }
52 #define GOOFIT_WARN_F(...) \
53  { \
54  std::cout << GooFit::reset << GooFit::yellow << GooFit::bold; \
55  fmt::printf(__VA_ARGS__); \
56  std::cout << GooFit::reset << std::endl; \
57  }
58 #define GOOFIT_ERROR(...) \
59  { \
60  std::cout << GooFit::reset << GooFit::red << GooFit::bold; \
61  fmt::print(__VA_ARGS__); \
62  std::cout << GooFit::reset << std::endl; \
63  }
64 #define GOOFIT_ERROR_F(...) \
65  { \
66  std::cout << GooFit::reset << GooFit::red << GooFit::bold; \
67  fmt::printf(__VA_ARGS__); \
68  std::cout << GooFit::reset << std::endl; \
69  }
70 
71 #ifdef GOOFIT_DEBUG_FLAG
72 #ifndef __CUDA_ARCH__
73 #define GOOFIT_DEBUG(...) \
74  { \
75  std::cout << GooFit::reset << GooFit::cyan << GooFit::bold << "DEBUG: "; \
76  fmt::print(__VA_ARGS__); \
77  std::cout << GooFit::reset << std::endl; \
78  }
79 #define GOOFIT_DEBUG_F(...) \
80  { \
81  std::cout << GooFit::reset << GooFit::cyan << GooFit::bold << "DEBUG: "; \
82  fmt::printf(__VA_ARGS__); \
83  std::cout << GooFit::reset << std::endl; \
84  }
85 #else
86 #define GOOFIT_DEBUG(...) \
87  {}
88 #define GOOFIT_DEBUG_F(...) \
89  { \
90  if(blockId.x == 0 && blockId.y == 0 && threadId.x == 0 && threadId.y == 0) { \
91  printf(__VA_ARGS__); \
92  } \
93  }
94 #endif
95 #else
96 #define GOOFIT_DEBUG(...) \
97  {}
98 #define GOOFIT_DEBUG_F(...) \
99  {}
100 #endif
101 #ifdef GOOFIT_TRACE_FLAG
102 #ifndef __CUDA_ARCH__
103 #define GOOFIT_TRACE(...) \
104  { \
105  std::cout << GooFit::reset << GooFit::cyan << "TRACE: "; \
106  fmt::print(__VA_ARGS__); \
107  std::cout << GooFit::reset << std::endl; \
108  }
109 #define GOOFIT_TRACE_F(...) \
110  { \
111  std::cout << GooFit::reset << GooFit::cyan << "TRACE: "; \
112  fmt::printf(__VA_ARGS__); \
113  std::cout << GooFit::reset << std::endl; \
114  }
115 #else
116 #define GOOFIT_TRACE(...) \
117  {}
118 #define GOOFIT_TRACE_F(...) \
119  { \
120  if(blockId.x == 0 && blockId.y == 0 && threadId.x == 0 && threadId.y == 0) { \
121  printf(__VA_ARGS__); \
122  } \
123  }
124 #endif
125 #else
126 #define GOOFIT_TRACE(...) \
127  {}
128 #define GOOFIT_TRACE_F(...) \
129  {}
130 #endif
131 
132 } // namespace GooFit