From f2d7596be583a130a5901a168702959791e5fb69 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 10 Jun 2016 10:28:58 +0200 Subject: [PATCH] #3 docu log --- log/error_handler/error_handler.php | 28 +++++-- log/error_handler/error_handler_dbwriter.php | 35 ++++++--- .../error_handler_jsonoutput.php | 25 ++++++- log/exceptions/COUNTER.php | 16 +++- log/exceptions/CRON.php | 16 +++- log/exceptions/DEPRECATED.php | 13 ++++ log/exceptions/ERROR.php | 13 ++++ log/exceptions/ERROR_EXCEPTION.php | 13 ++++ log/exceptions/INFO.php | 16 +++- log/exceptions/SHUTDOWN_EXCEPTION.php | 13 ++++ log/exceptions/SYSTEM_ERROR_EXCEPTION.php | 28 ++++++- log/exceptions/SYSTEM_EXCEPTION.php | 27 ++++++- log/exceptions/TODO.php | 20 +++++ log/exceptions/TranslatableError.php | 26 ++++++- log/exceptions/WARNING.php | 13 ++++ log/exceptions_shortcut/DEPRECATED.php | 14 ++++ log/exceptions_shortcut/ERROR.php | 14 ++++ log/exceptions_shortcut/INFO.php | 14 ++++ log/exceptions_shortcut/TODO.php | 14 ++++ log/exceptions_shortcut/WARNING.php | 14 ++++ log/log.php | 74 ++++++++++++++++--- log/qq/SYS_LOG_DEL.php | 14 ++++ log/qq/SYS_LOG_INSERT.php | 14 ++++ log/qq/SYS_LOG_MONTH.php | 14 ++++ log/qq/SYS_LOG_OLDEST.php | 14 ++++ log/result/AbstractResult.php | 15 ---- log/result/JsonResult.php | 58 +++++++++++---- log/result_shortcut/JsonResult.php | 13 ++++ 28 files changed, 513 insertions(+), 75 deletions(-) delete mode 100644 log/result/AbstractResult.php diff --git a/log/error_handler/error_handler.php b/log/error_handler/error_handler.php index 093707c..70e03ea 100644 --- a/log/error_handler/error_handler.php +++ b/log/error_handler/error_handler.php @@ -1,12 +1,26 @@ logged){ return false;} //alrdy logged(this prevents proper thrown value for every system exception) - $result = \SYSTEM\SQL\SYS_LOG_INSERT::QI( /*array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), - getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5), - $_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST), - array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, - array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null, - ($user = \SYSTEM\SECURITY\security::getUser()) ? $user->id : null, $thrown ? 1 : 0),*/ - array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), + $result = \SYSTEM\SQL\SYS_LOG_INSERT::QI(array( + get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5), $_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST), array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, diff --git a/log/error_handler/error_handler_jsonoutput.php b/log/error_handler/error_handler_jsonoutput.php index 2058311..98f236e 100644 --- a/log/error_handler/error_handler_jsonoutput.php +++ b/log/error_handler/error_handler_jsonoutput.php @@ -1,15 +1,34 @@ Ignore - return die(); //die is required cuz else some fatals cant be catched properly + return true; } } } \ No newline at end of file diff --git a/log/exceptions/COUNTER.php b/log/exceptions/COUNTER.php index 26dcfbd..cb50e33 100644 --- a/log/exceptions/COUNTER.php +++ b/log/exceptions/COUNTER.php @@ -1,5 +1,17 @@ 0, 'status' => false, 'result' => $error); @@ -48,5 +101,4 @@ class log { return json_encode($result);} return $bufferContent; } -} - +} \ No newline at end of file diff --git a/log/qq/SYS_LOG_DEL.php b/log/qq/SYS_LOG_DEL.php index 10ec961..657cbbc 100644 --- a/log/qq/SYS_LOG_DEL.php +++ b/log/qq/SYS_LOG_DEL.php @@ -1,5 +1,19 @@ getMessage(); $error['code'] = $e->getCode(); $error['file'] = $e->getFile(); $error['line'] = $e->getLine(); - $error['trace'] = array_slice(explode('#', $e->getTraceAsString()), 1, -1); - - return self::toString($error, self::JSONRESULT_ERROR); + $error['trace'] = array_slice(explode('#', $e->getTraceAsString()), 1, -1); + return self::toString($error, false); } - //Returns OK status + /** + * Retun JsonResult with success status + * + * @return string Returns json string. + */ public static function ok(){ return self::toString(NULL);} + + /** + * Retun JsonResult with failure status + * + * @return string Returns json string. + */ public static function fail(){ - return self::toString(NULL,self::JSONRESULT_ERROR);} + return self::toString(NULL,false);} } \ No newline at end of file diff --git a/log/result_shortcut/JsonResult.php b/log/result_shortcut/JsonResult.php index 30dabf6..aa65783 100644 --- a/log/result_shortcut/JsonResult.php +++ b/log/result_shortcut/JsonResult.php @@ -1,3 +1,16 @@