33
44#include < string>
55#include < fstream>
6- #include < cstdlib>
76#include < nlohmann/json.hpp>
87
8+ #define MAX_TRACES 1000000
9+ #define MAX_TRACERS 100
10+
911class Tracer {
1012protected:
1113using string = std::string;
@@ -15,9 +17,6 @@ class Tracer {
1517static int tracerCount;
1618static json traces;
1719
18- static const long maxTraces;
19- static const long maxTracers;
20-
2120static stringaddTracer (string className, string title) {
2221 string key =std::to_string (tracerCount++) +" -" + className +" -" + title;
2322 string method =" construct" ;
@@ -32,8 +31,8 @@ class Tracer {
3231 {" method" , method},
3332 {" args" , args},
3433 });
35- if (traces.size () >maxTraces )throw std::overflow_error (" Traces Limit Exceeded" );
36- if (tracerCount >maxTracers )throw std::overflow_error (" Tracers Limit Exceeded" );
34+ if (traces.size () >MAX_TRACES )throw std::overflow_error (" Traces Limit Exceeded" );
35+ if (tracerCount >MAX_TRACERS )throw std::overflow_error (" Tracers Limit Exceeded" );
3736 }
3837
3938 string key;
@@ -54,9 +53,6 @@ class Tracer {
5453int Tracer::tracerCount =0 ;
5554nlohmann::json Tracer::traces = json::array();
5655
57- const long Tracer::maxTraces = std::stol(getenv(" MAX_TRACES" ));
58- const long Tracer::maxTracers = std::stol(getenv(" MAX_TRACERS" ));
59-
6056int init () {
6157atexit (Tracer::onExit);
6258return 0 ;