Skip to content

Commit

Permalink
Merge pull request #148 from creative-commoners/pulls/2/log-deprecations
Browse files Browse the repository at this point in the history
ENH Ensure deprecation notices are collected
  • Loading branch information
GuySartorelli authored Mar 9, 2023
2 parents d346a87 + e0dd767 commit 85fa03e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/DebugBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use LeKoala\DebugBar\Collector\SilverStripeCollector;
use SilverStripe\Config\Collections\DeltaConfigCollection;
use SilverStripe\Config\Collections\CachedConfigCollection;
use SilverStripe\Dev\Deprecation;

/**
* A simple helper
Expand Down Expand Up @@ -402,6 +403,13 @@ public static function renderDebugBar()
$initialize = false;
}

// Normally deprecation notices are output in a shutdown function, which runs well after debugbar has rendered.
// This ensures the deprecation notices which have been noted up to this point are logged out and collected by
// the MonologCollector.
if (method_exists(Deprecation::class, 'outputNotices')) {
Deprecation::outputNotices();
}

$script = self::$renderer->render($initialize);
return $script;
}
Expand Down

0 comments on commit 85fa03e

Please sign in to comment.