File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 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:
1113 using string = std::string;
@@ -15,9 +17,6 @@ class Tracer {
1517 static int tracerCount;
1618 static json traces;
1719
18- static const long maxTraces;
19- static const long maxTracers;
20-
2120 static string addTracer (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 () {
6157 atexit (Tracer::onExit);
6258 return 0 ;
You can’t perform that action at this time.
0 commit comments