From 5065db5a2a49a2b518b2f73794e1e2759f077583 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 22 Dec 2011 11:03:00 -0800 Subject: [PATCH] Reduce spew of some daemons Summary: It used to be more useful for daemons to spew random debugging information, but features like "phd debug" and some fixes to error reporting like D1101 provide better ways to debug, test, develop and diagnose daemons. - Stop writing "." every time MetaMTA sends a message. - Stop spewing the entire IRC protocol from the IRC bot unless in debug mode. - Stop writing GC daemon log entries about collecting daemon logs (DURRR) unless in debug mode. Test Plan: Ran daemons in debug and non-debug modes, got expected level of noisiness. Reviewers: jungejason, nh, btrahan Reviewed By: jungejason CC: aran, jungejason Differential Revision: https://secure.phabricator.com/D1268 --- .../metamta/daemon/mta/PhabricatorMetaMTADaemon.php | 1 - .../PhabricatorGarbageCollectorDaemon.php | 3 +++ src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/applications/metamta/daemon/mta/PhabricatorMetaMTADaemon.php b/src/applications/metamta/daemon/mta/PhabricatorMetaMTADaemon.php index 4058924a27..43f2c8fc4f 100644 --- a/src/applications/metamta/daemon/mta/PhabricatorMetaMTADaemon.php +++ b/src/applications/metamta/daemon/mta/PhabricatorMetaMTADaemon.php @@ -27,7 +27,6 @@ class PhabricatorMetaMTADaemon extends PhabricatorDaemon { time()); foreach ($mail as $message) { $message->sendNow(); - echo "."; } $this->sleep(1); } while (true); diff --git a/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollectorDaemon.php b/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollectorDaemon.php index 4faad2c859..641a48651a 100644 --- a/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollectorDaemon.php +++ b/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollectorDaemon.php @@ -72,6 +72,9 @@ class PhabricatorGarbageCollectorDaemon extends PhabricatorDaemon { $collected = array_filter($collected); foreach ($collected as $thing => $count) { + if ($thing == 'Daemon Log' && !$this->getTraceMode()) { + continue; + } $count = number_format($count); echo "Garbage collected {$count} '{$thing}' objects.\n"; } diff --git a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php index ae2b394133..be1c529791 100644 --- a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php +++ b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php @@ -236,9 +236,11 @@ final class PhabricatorIRCBot extends PhabricatorDaemon { } private function debugLog($is_read, $message) { - echo $is_read ? '<<< ' : '>>> '; - echo addcslashes($message, "\0..\37\177..\377"); - echo "\n"; + if ($this->getTraceMode()) { + echo $is_read ? '<<< ' : '>>> '; + echo addcslashes($message, "\0..\37\177..\377"); + echo "\n"; + } } public function getConduit() {