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
This commit is contained in:
Tom Rix 2009-07-27 03:52:40 +00:00
parent ce9a4b158d
commit 0609a8e9cd

View File

@ -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.