git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
docs
[plcapi.git]
/
src
/
Helper
/
Logger.php
diff --git
a/src/Helper/Logger.php
b/src/Helper/Logger.php
index
77e0e14
..
b022311
100644
(file)
--- a/
src/Helper/Logger.php
+++ b/
src/Helper/Logger.php
@@
-2,6
+2,9
@@
namespace PhpXmlRpc\Helper;
namespace PhpXmlRpc\Helper;
+/**
+ * @todo make constructor private to force users to go through `instance()`
+ */
class Logger
{
protected static $instance = null;
class Logger
{
protected static $instance = null;
@@
-28,7
+31,7
@@
class Logger
* @param string $message
* @param string $encoding
*/
* @param string $message
* @param string $encoding
*/
- public function debugMessage($message, $encoding
=
null)
+ public function debugMessage($message, $encoding
=
null)
{
// US-ASCII is a warning for PHP and a fatal for HHVM
if ($encoding == 'US-ASCII') {
{
// US-ASCII is a warning for PHP and a fatal for HHVM
if ($encoding == 'US-ASCII') {
@@
-36,7
+39,14
@@
class Logger
}
if (PHP_SAPI != 'cli') {
}
if (PHP_SAPI != 'cli') {
- $flags = ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE;
+ $flags = ENT_COMPAT;
+ // avoid warnings on php < 5.4...
+ if (defined('ENT_HTML401')) {
+ $flags = $flags | ENT_HTML401;
+ }
+ if (defined('ENT_SUBSTITUTE')) {
+ $flags = $flags | ENT_SUBSTITUTE;
+ }
if ($encoding != null) {
print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>";
} else {
if ($encoding != null) {
print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>";
} else {
@@
-49,4
+59,13
@@
class Logger
// let the user see this now in case there's a time out later...
flush();
}
// let the user see this now in case there's a time out later...
flush();
}
+
+ /**
+ * Writes a message to the error log
+ * @param string $message
+ */
+ public function errorLog($message)
+ {
+ error_log($message);
+ }
}
}