File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 3
3
4
4
#include < string>
5
5
#include < fstream>
6
- #include < cstdlib>
7
6
#include < nlohmann/json.hpp>
8
7
8
+ #define MAX_TRACES 1000000
9
+ #define MAX_TRACERS 100
10
+
9
11
class Tracer {
10
12
protected:
11
13
using string = std::string;
@@ -15,9 +17,6 @@ class Tracer {
15
17
static int tracerCount;
16
18
static json traces;
17
19
18
- static const long maxTraces;
19
- static const long maxTracers;
20
-
21
20
static string addTracer (string className, string title) {
22
21
string key = std::to_string (tracerCount++) + " -" + className + " -" + title;
23
22
string method = " construct" ;
@@ -32,8 +31,8 @@ class Tracer {
32
31
{" method" , method},
33
32
{" args" , args},
34
33
});
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" );
37
36
}
38
37
39
38
string key;
@@ -54,9 +53,6 @@ class Tracer {
54
53
int Tracer::tracerCount = 0 ;
55
54
nlohmann::json Tracer::traces = json::array();
56
55
57
- const long Tracer::maxTraces = std::stol(getenv(" MAX_TRACES" ));
58
- const long Tracer::maxTracers = std::stol(getenv(" MAX_TRACERS" ));
59
-
60
56
int init () {
61
57
atexit (Tracer::onExit);
62
58
return 0 ;
You can’t perform that action at this time.
0 commit comments