Skip to content

Commit

Permalink
Merge pull request #828 from nexcess/devel
Browse files Browse the repository at this point in the history
refs #522 Custom log file and #801 recently viewed products
  • Loading branch information
miguelbalparda committed Jun 26, 2015
2 parents 3281ae2 + 21c3b82 commit 598bb2f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,5 @@ Magento CE 1.8+ or EE 1.13+, see [these instructions](https://github.com/nexcess
* [#499] Use rewrite instead of local Session model for form key handling (@eth8505)
* [#817] Damian/cache management extended. Added validations for EE and Full Page cache (@damian-pastorini)
* [#521] Fix for search input field on search results page (@jeroenvermeulen)

* Fix for recently viewed products block in CE 1.9.1 (Issue #801)
* [#522] Custom log file (issue #510) (@eth8505)
31 changes: 30 additions & 1 deletion app/code/community/Nexcessnet/Turpentine/Helper/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,39 @@ public function logValue( $value, $name=null ) {
*/
protected function _log( $level, $message ) {
$message = 'TURPENTINE: ' . $message;
Mage::log( $message, $level );
Mage::log( $message, $level, $this->_getLogFileName() );
return $message;
}

/**
* Get the name of the log file to use
* @return string
*/
protected function _getLogFileName() {
if ( $this->useCustomLogFile() ) {
return $this->getCustomLogFileName();
}
return '';
}

/**
* Check if custom log file should be used
* @return bool
*/
public function useCustomLogFile() {
return Mage::getStoreConfigFlag(
'turpentine_varnish/logging/use_custom_log_file' );
}

/**
* Get custom log file name
* @return string
*/
public function getCustomLogFileName() {
return (string)Mage::getStoreConfig(
'turpentine_varnish/logging/custom_log_file_name' );
}

/**
* Format a list of function arguments for the backtrace
*
Expand Down
4 changes: 4 additions & 0 deletions app/code/community/Nexcessnet/Turpentine/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<crawler_enable>0</crawler_enable>
<crawler_debug>0</crawler_debug>
</general>
<logging>
<use_custom_log_file>0</use_custom_log_file>
<custom_log_file_name>turpentine.log</custom_log_file_name>
</logging>
<servers>
<version>auto</version>
<server_list>127.0.0.1:6082</server_list>
Expand Down
31 changes: 31 additions & 0 deletions app/code/community/Nexcessnet/Turpentine/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@
</crawler_debug>
</fields>
</general>
<logging translate="label" module="turpentine">
<label>Logging</label>
<sort_order>15</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<use_custom_log_file translate="label,comment" module="turpentine">
<label>Use custom log file</label>
<comment>Log to custom log file rather than system.log</comment>
<frontend_type>select</frontend_type>
<source_model>turpentine/config_select_toggle</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</use_custom_log_file>
<custom_log_file_name translate="label,comment" module="turpentine">
<label>Custom log file name</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<comment>Only enter a file name, no paths.</comment>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<depends>
<use_custom_log_file>1</use_custom_log_file>
</depends>
</custom_log_file_name>
</fields>
</logging>
<servers translate="label" module="turpentine">
<label>Servers</label>
<frontend_type>text</frontend_type>
Expand Down
14 changes: 14 additions & 0 deletions app/design/frontend/base/default/layout/turpentine_esi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@
</reference>
</catalogsearch_result_index>

<!-- fixes issues with 'recently viewed products' in CE 1.9's RWD theme -->
<catalog_category_layered_nochildren>
<reference name="left.reports.product.viewed">
<action method="setEsiOptions">
<params>
<access>private</access>
<flush_events>
<catalog_controller_product_view/>
</flush_events>
</params>
</action>
</reference>
</catalog_category_layered_nochildren>

<!-- Checkout -->

<!-- We cache the checkout cart page on a per-client basis -->
Expand Down

0 comments on commit 598bb2f

Please sign in to comment.