Skip to content

Commit

Permalink
Add new Show FireLogger option which can be disabled on nginx servers…
Browse files Browse the repository at this point in the history
… suffering from 502 bad gateway errors.
  • Loading branch information
adrianbj committed Mar 18, 2018
1 parent b396090 commit 539ebc8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
14 changes: 13 additions & 1 deletion TracyDebugger.module
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
'summary' => __('Tracy debugger from Nette with several PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/topic/12208-tracy-debugger/',
'version' => '4.9.30',
'version' => '4.9.31',
'autoload' => true,
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down Expand Up @@ -223,6 +223,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
"customPhpCode" => '',
"email" => '',
"clearEmailSent" => null,
"showFireLogger" => 1,
"referencePageEdited" => 1,
"editor" => 'subl://open/?url=file://%file&line=%line',
"useOnlineEditor" => array(),
Expand Down Expand Up @@ -710,6 +711,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
}
}

Debugger::$showFireLogger = $this->data['showFireLogger'];

if($this->allowedTracyUsers() === 'development') {

Expand Down Expand Up @@ -2282,11 +2284,21 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
$f->attr('value', $data['maxLength']);
$fieldset->add($f);

$f = $this->wire('modules')->get("InputfieldCheckbox");
$f->attr('name', 'showFireLogger');
$f->label = __('Send data to FireLogger', __FILE__);
$f->description = __('When checked, certain errors and `fl()` calls will be sent to FireLogger in the browser console.', __FILE__);
$f->notes = __('If you are running on nginx and don\'t have access to adjust `fastcgi_buffers` and `fastcgi_buffer_size` settings, you may want to uncheck this to avoid 502 bad gateway errors because of `upstream sent too big header while reading response header from upstreamupstream sent too big` issues.', __FILE__);
$f->columnWidth = 50;
$f->attr('checked', $data['showFireLogger'] == '1' ? 'checked' : '' );
$fieldset->add($f);

$f = $this->wire('modules')->get("InputfieldCheckbox");
$f->attr('name', 'referencePageEdited');
$f->label = __('Reference page being edited', __FILE__);
$f->description = __('When editing a page in the admin, the Request Info Panel will show details of the page being edited, and the Consol Panel will assign the $page variable to the page being edited.', __FILE__);
$f->notes = __('Highly recommended unless you have a reason not to do this.', __FILE__);
$f->columnWidth = 50;
$f->attr('checked', $data['referencePageEdited'] == '1' ? 'checked' : '' );
$fieldset->add($f);

Expand Down
24 changes: 14 additions & 10 deletions panels/RequestInfoPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,34 +607,37 @@ public function getPanel() {
}


private function getFieldArray(Page $p, $f){
private function getFieldArray(Page $p, $f) {
$fieldArray = '';
if($f->type == "FieldtypeFieldsetTabOpen"
|| $f->type == "FieldtypeFieldsetTabClose"
|| $f->type == "FieldtypeFieldsetOpen"
|| $f->type == "FieldtypePassword"
|| $f->type == "FieldtypeFieldsetClose") return false;

if($f->type == "FieldtypeRepeater"){
if(count($p->$f)){
if($f->type == "FieldtypeRepeater") {
if(count($p->$f)) {
$fieldArray = array();
foreach($p->$f as $o) $fieldArray[$o->id] = $o->getIterator();
}
} else if($f->type == "FieldtypePage"){
if(count($p->$f)){
}
elseif($f->type == "FieldtypePage") {
if(count($p->$f)) {
$fieldArray = array();
if($p->$f instanceof PageArray){
if($p->$f instanceof PageArray) {
foreach($p->$f as $o) $fieldArray[$o->id] = $o->getIterator();
}
else {
if($p->$f) $fieldArray[$p->$f->id] = $p->$f->getIterator();
else $fieldArray = '';
}
} else {
}
else {
$fieldArray = $p->$f;
}
} else if($f->type == "FieldtypeImage" || $f->type == " FieldtypeFile"){
if(count($p->$f)){
}
elseif($f->type == "FieldtypeImage" || $f->type == " FieldtypeFile") {
if(count($p->$f)) {
$fieldArray = array();
foreach($p->$f as $o) {
$fieldArray[$o->filename] = $o->getIterator();
Expand All @@ -656,7 +659,8 @@ private function getFieldArray(Page $p, $f){

}
}
} else {
}
else {
$p->of(true);
$fieldArray = $p->$f ? $p->$f : '';
$p->of(false);
Expand Down
5 changes: 4 additions & 1 deletion tracy-master/src/Tracy/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class Debugger
/** @var bool whether to display debug bar in development mode */
public static $showBar = true;

/** @var bool whether to send data to FireLogger in development mode */
public static $showFireLogger = true;

/** @var bool whether to disable the shutdown handler in development mode */
public static $disableShutdownHandler = false;

Expand Down Expand Up @@ -622,7 +625,7 @@ public static function log($message, $priority = ILogger::INFO)
*/
public static function fireLog($message)
{
if (!self::$productionMode) {
if (!self::$productionMode && self::$showFireLogger) {
return self::getFireLogger()->log($message);
}
}
Expand Down
3 changes: 3 additions & 0 deletions tracy-master/src/Tracy/FireLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
namespace Tracy;



/**
* FireLogger console logger.
*
* @see http://firelogger.binaryage.com
* @see https://chrome.google.com/webstore/detail/firelogger-for-chrome/hmagilfopmdjkeomnjpchokglfdfjfeh
*
*/
class FireLogger implements ILogger
{
Expand Down

0 comments on commit 539ebc8

Please sign in to comment.