Duffer Derek
<?php namespace App\Repository\General;
use Exception;
/**
* Created by PhpStorm.
* User: jis
* Date: 29/3/17
* Time: 10:21 AM
*/
class Log
{
public static function logError($error, $details = null, $message = "error")
{
try {
if (is_array($details))
$details = json_encode($details);
$sql = "insert into `error_logs` (`message`, `error`, `ref_type`, `ref_id` ,`details`)
values ( :message, :error,:ref_type,:ref_id,:details )";
$STH = DB::prepare($sql);
$STH->execute(array("message" => $message, "error" => $error, "details" => $details,
"ref_type" => Constants::getREFTYPE(), "ref_id" => Constants::getREFID()));
} catch (Exception $e) {
}
}
public static function log($message, $details = null, $type = "message")
{
try {
if (is_array($details))
$details = json_encode($details);
$table = "`logs`";
if ($type != "message")
$table = "`log_info`";
$sql = "insert into $table ( `type`, `message`,`details`,`ref_type`, `ref_id` )
values ( :type,:message,:details , :ref_type,:ref_id)";
$STH = DB::prepare($sql);
$STH->execute(array("message" => $message, "type" => $type, "details" => $details,
"ref_type" => Constants::getREFTYPE(), "ref_id" => Constants::getREFID()));
} catch (Exception $e) {
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists