| 1 |
<?php |
| 2 |
class berqLogs { |
| 3 |
private $logFile; |
| 4 |
|
| 5 |
public function __construct() { |
| 6 |
$this->logFile = optifer_cache . 'berqwp.log'; |
| 7 |
} |
| 8 |
|
| 9 |
public function log($message, $status = 'INFO') { |
| 10 |
$timestamp = date('Y-m-d H:i:s'); |
| 11 |
$logEntry = "[$timestamp][$status]: $message" . PHP_EOL; |
| 12 |
file_put_contents($this->logFile, $logEntry, FILE_APPEND); |
| 13 |
} |
| 14 |
|
| 15 |
public function info($message) { |
| 16 |
$this->log($message, 'INFO'); |
| 17 |
} |
| 18 |
|
| 19 |
public function warning($message) { |
| 20 |
$this->log($message, 'WARNING'); |
| 21 |
} |
| 22 |
|
| 23 |
public function error($message) { |
| 24 |
$this->log($message, 'ERROR'); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
global $berq_log; |
| 29 |
$berq_log = new berqLogs(); |