From 0609a8e9cd16249181afe2674dedde8767f3c831 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 27 Jul 2009 03:52:40 +0000 Subject: [PATCH] MINOR added Debug::header() for fun debugging. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@82759 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/Debug.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dev/Debug.php b/dev/Debug.php index 1482fb2c6..70fd25ef3 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -165,6 +165,24 @@ class Debug { } } } + + // Keep track of how many headers have been sent + static $headerCount = 0; + + /** + * Send a debug message in an HTTP header. Only works if you are + * on Dev, and headers have not yet been sent. + * + * @param string $msg + * @param string $prefix (optional) + * @return void + */ + static function header($msg, $prefix) { + if (Director::isDev() && !headers_sent()) { + self::$headerCount++; + header('SS-'.self::$headerCount.($prefix?'-'.$prefix:'').': '.$msg); + } + } /** * Log to a standard text file output.