Skip to content

Commit 9ceb3b1

Browse files
authored
Merge pull request #20 from bufferapp/task/message-fields
Don't show dd trace hints in local env
2 parents 5883134 + c3d2e29 commit 9ceb3b1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
BuffLog::error("I am an error");
1818
BuffLog::error("I am an error", ["mean" => "70"]);
1919

20-
BuffLog::criticals("I am criticals information with a typo and you shouldn't see me!");
20+
BuffLog::critical("I am criticals information with a typo and you shouldn't see me!");
2121
BuffLog::critical("I am critical information!", ["user" => "betrand"]);
2222

2323
BuffLog::critical("I'm critical log, here some extra fancy informations",

src/BuffLog/BuffLog.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ protected static function configureInstance()
4343
if (class_exists("\DDTrace\GlobalTracer")) {
4444
self::$hasGlobalTracer = true;
4545
} else {
46-
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.");
47-
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?");
46+
// local envs don't need tracing
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?");
50+
}
4851
}
4952

5053
// @TODO: We could potentially use the Kubernetes downward API to

0 commit comments

Comments
 (0)