public function entry($message, $level = Logular\LogLevel::INFO, $variable = null) { try { $message = parent::entry($message, $level, $variable); } catch (\Exception $e) { return; } echo $message, PHP_EOL; return $message; }
public function __construct($dsn = false, $username = "", $password = "", $attributes = [], $pdo = false) { if (!$dsn && !$pdo) { throw new \Exception("You must provide a DSN or PDO object"); } if ($dsn) { $pdo = new \PDO($dsn, $username, $password, $attributes); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } $this->pdo = $pdo; $this->insert = $pdo->prepare("INSERT INTO logging (level, message, pid) VALUES (:level, :message, :pid)"); parent::__construct(); }
public function entry($message, $level = Logular\LogLevel::INFO, $variable = null) { try { $message = parent::entry($message, $level, $variable); } catch (Exception $e) { return; } if (!$this->logHandle) { throw new Exception('Cannot write to log file, log is not open'); } fwrite($this->logHandle, $message . PHP_EOL); return $message; }