Skip to content

Commit

Permalink
try to fix logging on PHP7
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Dec 24, 2021
1 parent adbf3fa commit 5ae2aa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.3 rev 8282
1.2.3 rev 8283
8 changes: 2 additions & 6 deletions api/libs/api.olltv.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,10 @@ protected function _toLog($message, $type = 1) {
if ($type > $this->_logLevel) {
return false;
}
// verify path to log file and write access
// if (!is_writable($this->_log)) {
// return false;
// }
// prepare message type
$type = $this->_logType[$type] . ': ';
// append write to file and get result
$res = file_put_contents($this->_log, date('Y-m-d H:i:s') . ' ' . $type . $message . ";\n", FILE_APPEND | LOCK_EX);
$res = file_put_contents($this->_log, date('Y-m-d H:i:s') . ' ' . $type . $message . ";\n", FILE_APPEND);
return (bool) $res;
}

Expand Down Expand Up @@ -429,7 +425,7 @@ protected function _return() {

// log warnings
if (!empty($this->_result->warnings)) {
$this->_toLog('[' . __FUNCTION__ . '] - API warnings: ' . (string) $this->_result->warnings);
$this->_toLog('[' . __FUNCTION__ . '] - API warnings: ' . print_r($this->_result->warnings, true));
}

// verify result status
Expand Down

0 comments on commit 5ae2aa0

Please sign in to comment.