1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-07 23:03:14 +02:00

Gelato ErrorHandler and Logger improvments

This commit is contained in:
Awilum
2013-01-25 21:49:28 +02:00
parent 0e5e21d5a3
commit c506bbff08
4 changed files with 18 additions and 8 deletions

View File

@ -113,9 +113,14 @@ class Monstra
* Set Gelato Display Errors to False for Production environment.
*/
if (Monstra::$environment == Monstra::PRODUCTION) {
define('GELATO_DISPLAY_DEVELOPMENT', false);
define('GELATO_DEVELOPMENT', false);
}
/**
* Define Monstra Folder for Gelato Logs
*/
define ('GELATO_LOGS_PATH', LOGS);
/**
* Include Gelato Library
*/

View File

@ -88,7 +88,7 @@ class ErrorHandler
/**
* Dont thow NOTICE exception for PRODUCTION Environment. Just write to log.
*/
if (GELATO_DISPLAY_DEVELOPMENT == false && $code == 8) {
if (GELATO_DEVELOPMENT == false && $code == 8) {
// Get exception info
$error['code'] = $code;
@ -275,7 +275,7 @@ class ErrorHandler
// Send headers and output
@header('Content-Type: text/html; charset=UTF-8');
if (GELATO_DISPLAY_DEVELOPMENT) {
if (GELATO_DEVELOPMENT) {
$error['backtrace'] = $exception->getTrace();

View File

@ -23,8 +23,8 @@ define('GELATO_VERSION', '1.0.0');
/**
* Display Gelato Errors or not ?
*/
if ( ! defined('GELATO_DISPLAY_DEVELOPMENT')) {
define('GELATO_DISPLAY_DEVELOPMENT', true);
if ( ! defined('GELATO_DEVELOPMENT')) {
define('GELATO_DEVELOPMENT', true);
}
/**
@ -42,10 +42,15 @@ require_once __DIR__ . '/Log/Log.php';
/**
* Use Gelato Logger default path or not ?
*/
if ( ! defined('GELATO_LOGGER')) {
Log::configure('path', __DIR__. '/_logs');
if ( ! defined('GELATO_LOGS_PATH')) {
define('GELATO_LOGS_PATH', __DIR__. '/_logs');
}
/**
* Configure Gelato Logger
*/
Log::configure('path', GELATO_LOGS_PATH);
/**
* Load Gelato Error Handler
*/

View File

@ -81,7 +81,7 @@ class Log
*/
public static function write($message, $type = Log::ERROR)
{
$file = rtrim(Log::$path, '/') . '/' . Log::$types[$type] . '_' . gmdate('Y_m_d') . '.log';
$file = rtrim(Log::$path, '/') . '/' . gmdate('Y_m_d') . '.log';
$message = '[' . gmdate('d-M-Y H:i:s') . '] ' . $message . PHP_EOL;