Skip to content

Instantly share code, notes, and snippets.

@sminnee
Created April 18, 2017 06:05
Show Gist options
  • Select an option

  • Save sminnee/5316bbd515b126270da4a40203d8b0a3 to your computer and use it in GitHub Desktop.

Select an option

Save sminnee/5316bbd515b126270da4a40203d8b0a3 to your computer and use it in GitHub Desktop.
diff --git a/src/Dev/Debug.php b/src/Dev/Debug.php
index 06d7ec9..38f1947 100644
--- a/src/Dev/Debug.php
+++ b/src/Dev/Debug.php
@@ -8,6 +8,8 @@ use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DB;
use SilverStripe\Security\Permission;
use SilverStripe\Security\Security;
+use Psr\Log\LoggerInterface;
+
/**
* Supports debugging and core error handling.
@@ -161,20 +163,7 @@ class Debug
public static function message($message, $showHeader = true)
{
if (!Director::isLive()) {
- $caller = Debug::caller();
- $file = basename($caller['file']);
- if (Director::is_cli()) {
- if ($showHeader) {
- echo "Debug (line $caller[line] of $file):\n ";
- }
- echo $message . "\n";
- } else {
- echo "<p class=\"message warning\">\n";
- if ($showHeader) {
- echo "<b>Debug (line $caller[line] of $file):</b>\n ";
- }
- echo Convert::raw2xml($message) . "</p>\n";
- }
+ Injector::inst()->get(LoggerInterface::class)->debug($message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment