Author: grobmeier
Date: Fri Jul  3 11:39:00 2009
New Revision: 790867

URL: http://svn.apache.org/viewvc?rev=790867&view=rev
Log:
moved global vars to class members

Modified:
    incubator/log4php/trunk/src/main/php/LoggerNDC.php

Modified: incubator/log4php/trunk/src/main/php/LoggerNDC.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerNDC.php?rev=790867&r1=790866&r2=790867&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerNDC.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerNDC.php Fri Jul  3 11:39:00 2009
@@ -19,7 +19,6 @@
  * @package log4php
  */
 
-define('LOGGER_NDC_HT_SIZE', 7);
 
 /**
  * This is the global repository of NDC stack
@@ -27,12 +26,6 @@
 $GLOBALS['log4php.LoggerNDC.ht'] = array();
 
 /**
- * This is the max depth of NDC stack
- */
-$GLOBALS['log4php.LoggerNDC.maxDepth'] = LOGGER_NDC_HT_SIZE;
-
-
-/**
  * The NDC class implements <i>nested diagnostic contexts</i> as
  * defined by Neil Harrison in the article "Patterns for Logging
  * Diagnostic Messages" part of the book "<i>Pattern Languages of
@@ -89,7 +82,7 @@
  * @since 0.3
  */
 class LoggerNDC {
-
+       const HT_SIZE = 7;
        /**
         * Clear any nested diagnostic information if any. This method is
         * useful in cases where the same thread can be potentially used
@@ -200,11 +193,10 @@
         */
        public static function setMaxDepth($maxDepth) {
                $maxDepth = (int)$maxDepth;
-               if($maxDepth <= LOGGER_NDC_HT_SIZE) {
+               if($maxDepth <= self::HT_SIZE) {
                        if(LoggerNDC::getDepth() > $maxDepth) {
                                $GLOBALS['log4php.LoggerNDC.ht'] = 
array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
                        }
-                       $GLOBALS['log4php.LoggerNDC.maxDepth'] = $maxDepth;     
                   
                }
        }
 


Reply via email to