From 7aba1dcebd40bcae670ba93d5791dca0d5a9ff7e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 27 Aug 2012 14:51:35 -0400 Subject: [PATCH] Added warning method. Changed some code to use it. --- airtime_mvc/application/logging/Logging.php | 15 +++++++++++++++ airtime_mvc/application/models/StoredFile.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/logging/Logging.php b/airtime_mvc/application/logging/Logging.php index 4145d4740..e89f23763 100644 --- a/airtime_mvc/application/logging/Logging.php +++ b/airtime_mvc/application/logging/Logging.php @@ -51,6 +51,21 @@ class Logging { $logger = self::getLogger(); $logger->info("[$file : $function() : line $line] - ".self::toString($p_msg)); } + + public static function warn($p_msg) + { + $bt = debug_backtrace(); + + $caller = array_shift($bt); + $file = basename($caller['file']); + $line = $caller['line']; + + $caller = array_shift($bt); + $function = $caller['function']; + + $logger = self::getLogger(); + $logger->info("[$file : $function() : line $line] [WARN] - ".self::toString($p_msg)); + } public static function debug($p_msg) { diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 70c804c92..9dc347f39 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -128,7 +128,7 @@ class Application_Model_StoredFile if (defined($mdConst)) { $dbMd[constant($mdConst)] = $mdValue; } else { - Logging::info("Warning: using metadata that is not defined. + Logging::warn("using metadata that is not defined. [$mdConst] => [$mdValue]"); } }