Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add option to enable/disable logging of invalid nesting. #8

Merged
merged 1 commit into from Feb 15, 2013
Jump to file or symbol
Failed to load files and symbols.
+17 −2
Split
@@ -34,6 +34,7 @@
<debug>
<showDisabledMessage>1</showDisabledMessage>
<hideLinesFasterThan>10</hideLinesFasterThan>
+ <logInvalidNesting>1</logInvalidNesting>
</debug>
</dev>
</default>
@@ -31,6 +31,16 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</hideLinesFasterThan>
+ <logInvalidNesting translate="label comment">
+ <label>Log invalid nesting</label>
+ <comment><![CDATA[Write information to system log when buckets are not started / stopped in correct order.]]></comment>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_yesno</source_model>
+ <sort_order>120</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </logInvalidNesting>
</fields>
</debug>
</groups>
@@ -92,14 +92,18 @@ public static function stop($name) {
$currentName = end(self::$stack);
if ($currentName != $name) {
- Mage::log('[INVALID NESTING!] Found: ' .$name . " | Expecting: $currentName");
+ if (Mage::getStoreConfigFlag('dev/debug/logInvalidNesting')) {
+ Mage::log('[INVALID NESTING!] Found: ' .$name . " | Expecting: $currentName");
+ }
if (in_array($name, self::$stack)) {
// trying to stop something that has been started before,
// but there are other unstopped stack items
// -> auto-stop them
while (($latestStackItem = end(self::$stack)) != $name) {
- Mage::log('Auto-stopping timer "' .$latestStackItem . '" because of incorrect nesting');
+ if (Mage::getStoreConfigFlag('dev/debug/logInvalidNesting')) {
+ Mage::log('Auto-stopping timer "' .$latestStackItem . '" because of incorrect nesting');
+ }
self::stop($latestStackItem);
}
} else {