LSlog : fix handling non-string message

This commit is contained in:
Benjamin Renard 2020-02-18 10:38:36 +01:00
parent 7f1fa41e3a
commit f32fb31d6e

View file

@ -141,6 +141,13 @@ class LSlog {
if (!array_key_exists($level, self :: $levels)) if (!array_key_exists($level, self :: $levels))
$level = self :: $default_level; $level = self :: $default_level;
// Handle non-string message
if (!is_string($message)) {
if (is_object($message) && method_exists($message, '__toString'))
$message = strval($message);
else
$message = varDump($message);
}
// Add prefix // Add prefix
if (php_sapi_name() == "cli") { if (php_sapi_name() == "cli") {