Tweeks of new Log System

This commit is contained in:
Václav Španinger 2020-07-29 08:44:11 +02:00
parent d404afe501
commit b174022f9a
3 changed files with 12 additions and 10 deletions

View File

@ -51,7 +51,7 @@ class ErrorHandler {
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
'trace' => $exception->getTrace(),
];
echo json_encode($message);

View File

@ -24,7 +24,7 @@ class LogManager
}
public function setLevel($type = LogRecordTypess::WARNING){
$logLevel = $type['level'];
$this->logLevel = $type['level'];
}
public function write($value, $type = LogRecordTypess::ERROR){

View File

@ -5,14 +5,16 @@
//TODO: Working timestamp to $title
class NotificationManager
{
public static function addSubscriber($userID = '', $token = ''){
$notificationSubscriber = $subDeviceId = Db::loadOne('SELECT id FROM notifications WHERE token = ?;', array($token));
if ($notificationSubscriber == ''){
$notification = array (
'user_id' => $userID,
'token' => $token,
);
Db::add ('notifications', $notification);
public static function addSubscriber($userID, $token){
if (!empty($userID) && !empty($token)) {
$notificationSubscriber = $subDeviceId = Db::loadOne('SELECT id FROM notifications WHERE token = ?;', array($token));
if ($notificationSubscriber == ''){
$notification = array (
'user_id' => $userID,
'token' => $token,
);
Db::add ('notifications', $notification);
}
}
}