You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/BuffLog/BuffLog.php
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,12 @@ protected static function configureInstance()
45
45
} else {
46
46
// local envs don't need tracing
47
47
if (getenv("ENVIRONMENT") !== "local") {
48
-
error_log("Tip #1: Can't find \DDTrace\GlobalTracer class. Did you install the Datadog APM tracer extension? It will allow you to have logs enriched with traces making troubleshooting easier.");
49
-
error_log("Tip #2: If you run a cli mode service (such as a worker), did you set the DD_TRACE_CLI_ENABLED env variable?");
48
+
echojson_encode([
49
+
"message" => "Can't find \DDTrace\GlobalTracer class. Did you install the Datadog APM tracer extension? It will allow you to have logs enriched with traces making troubleshooting easier. If you run a cli mode service (such as a worker), did you set the DD_TRACE_CLI_ENABLED env variable?",
50
+
"level" => 300,
51
+
"level_name" => "WARNING",
52
+
"context" => ["bufflog_error" => "no_tracer"]
53
+
]);
50
54
}
51
55
}
52
56
@@ -117,10 +121,10 @@ public static function __callStatic($methodName, $args)
117
121
}
118
122
}
119
123
} else {
120
-
error_log("BuffLog::$methodName() is not supported yet. Add it to the BuffLog whitelist to allow it");
124
+
self::getLogger()->warning("BuffLog::$methodName() is not supported yet. Add it to the BuffLog whitelist to allow it", ["bufflog_error" => "method_not_supported"]);
121
125
}
122
126
} else {
123
-
error_log("BuffLog::$methodName() method does not exist");
127
+
self::getLogger()->warning("BuffLog::$methodName() method does not exist", ["bufflog_error" => "method_not_exist"]);
124
128
}
125
129
126
130
returnfalse;
@@ -129,17 +133,17 @@ public static function __callStatic($methodName, $args)
self::getLogger()->warning("BuffLog: Malformed logs: Too many parameters", ["bufflog_error" => "incorrect_parameters", "args" => $args]);
133
137
returnfalse;
134
138
}
135
139
136
140
if (isset($args[0]) && !is_string($args[0])) {
137
-
error_log("BuffLog: First parameter must be a string");
141
+
self::getLogger()->warning("BuffLog: Malformed logs: First parameter must be a string", ["args" => $args, "bufflog_error" => "incorrect_parameters"]);
138
142
returnfalse;
139
143
}
140
144
141
145
if (isset($args[1]) && !is_array($args[1])) {
142
-
error_log("BuffLog: Second parameter must be an array");
146
+
self::getLogger()->warning("BuffLog: Malformed logs: Second parameter must be an array", ["args" => $args, "bufflog_error" => "incorrect_parameters"]);
0 commit comments