Commit fdc10bc8 by irul

move and simplify log_string

1 parent bb17a3a4
...@@ -85,7 +85,7 @@ class Logger ...@@ -85,7 +85,7 @@ class Logger
* */ * */
public function log($string) public function log($string)
{ {
$this->do_write(date(DATESTRING_FULL) . ' - ' . $string . PHP_EOL); $this->do_write($string);
} }
/* /*
...@@ -99,7 +99,7 @@ class Logger ...@@ -99,7 +99,7 @@ class Logger
* */ * */
public function dump($var_name, $string = '') public function dump($var_name, $string = '')
{ {
$this->do_write(date(DATESTRING_FULL) . (empty($string) ? ' - VARDUMP ' : ' - Dump of ') . $string . ' => ' . var_export($var_name, true) . PHP_EOL); $this->do_write((empty($string) ? 'VARDUMP ' : 'Dump of ') . $string . ' => ' . var_export($var_name, true));
} }
/* /*
...@@ -112,6 +112,9 @@ class Logger ...@@ -112,6 +112,9 @@ class Logger
* */ * */
public function do_write($log_string) public function do_write($log_string)
{ {
$log_string = sprintf("%s %s", date(DATESTRING_FULL), $log_string);
$log_string = $log_string . PHP_EOL;
if ($this->user_handle) { if ($this->user_handle) {
fwrite($this->user_log_handle, $log_string); fwrite($this->user_log_handle, $log_string);
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!