1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-07 13:46:38 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-03-04 17:20:46 +00:00

View File

@@ -66,7 +66,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
if (count(self::$records)) { if (count(self::$records)) {
if ($format === 'html') { if ($format === 'html') {
self::writeOutput('<script>', self::generateScript(), '</script>'); self::writeOutput('<script>' . self::generateScript() . '</script>');
} elseif ($format === 'js') { } elseif ($format === 'js') {
self::writeOutput(self::generateScript()); self::writeOutput(self::generateScript());
} }
@@ -105,6 +105,10 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
/** /**
* Checks the format of the response * Checks the format of the response
* *
* If Content-Type is set to application/javascript or text/javascript -> js
* If Content-Type is set to text/html, or is unset -> html
* If Content-Type is anything else -> unknown
*
* @return string One of 'js', 'html' or 'unknown' * @return string One of 'js', 'html' or 'unknown'
*/ */
protected static function getResponseFormat() protected static function getResponseFormat()
@@ -116,14 +120,15 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
// text/javascript is obsolete in favour of application/javascript, but still used // text/javascript is obsolete in favour of application/javascript, but still used
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
return 'js'; return 'js';
} elseif (stripos($header, 'text/html') !== false) { }
return 'html'; if (stripos($header, 'text/html') === false) {
return 'unknown';
} }
break; break;
} }
} }
return 'unknown'; return 'html';
} }
private static function generateScript() private static function generateScript()