From 56527e727c383ffa591465b1fd2bd465de6795cc Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 6 Sep 2012 12:17:18 -0400 Subject: [PATCH] extra debuggin --- .../controllers/ScheduleController.php | 8 ++++++-- airtime_mvc/application/logging/Logging.php | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 27239bee4..361798679 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -813,8 +813,8 @@ class ScheduleController extends Zend_Controller_Action $data[$j["name"]] = $j["value"]; } - $data['add_show_hosts'] = $this->_getParam('hosts'); - $data['add_show_day_check'] = $this->_getParam('days'); + $data['add_show_hosts'] = $this->_getParam('hosts'); + $data['add_show_day_check'] = $this->_getParam('days'); if ($data['add_show_day_check'] == "") { $data['add_show_day_check'] = null; @@ -828,10 +828,14 @@ class ScheduleController extends Zend_Controller_Action $this->view->addNewShow = true; $this->view->newForm = $this->view->render( 'schedule/add-show-form.phtml'); + Logging::debug("Show creation succeeded"); + Logging::sparse_debug( $data ); } else { $this->view->addNewShow = true; $this->view->form = $this->view->render(' schedule/add-show-form.phtml'); + Logging::debug("Show creation failed"); + Logging::sparse_debug( $data ); } } diff --git a/airtime_mvc/application/logging/Logging.php b/airtime_mvc/application/logging/Logging.php index e89f23763..0e2492f53 100644 --- a/airtime_mvc/application/logging/Logging.php +++ b/airtime_mvc/application/logging/Logging.php @@ -69,6 +69,10 @@ class Logging { public static function debug($p_msg) { + if (!(defined('APPLICATION_ENV') && APPLICATION_ENV == "development")) { + return; + } + $bt = debug_backtrace(); $caller = array_shift($bt); @@ -78,11 +82,16 @@ class Logging { $caller = array_shift($bt); $function = $caller['function']; - - if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development") { - $logger = self::getLogger(); - $logger->debug("[$file : $function() : line $line] - ".self::toString($p_msg)); - } + $logger = self::getLogger(); + $logger->debug("[$file : $function() : line $line] - ".self::toString($p_msg)); + } + // kind of like debug but for printing arrays more compactly (skipping + // empty elements + + public static function debug_sparse(array $p_msg) + { + Logging::debug("Sparse output:"); + Logging::debug( array_filter($p_msg) ); } public static function enablePropelLogging()