diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-07-17 18:36:13 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-07-17 18:36:13 -0700 |
commit | 9e8bcff5ddfc7d3e5785161078c5b1eaafea2f1e (patch) | |
tree | 0dbf63df1d2e0942a6a94be050554e6e114112ca /scripts | |
parent | 5d5401b371a7e88140219216f3daa9f9c6fecaaf (diff) |
Allow -d (debug logging) command line argument
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/twitterstatusfetcher.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 248cf86f1..e2ba1d003 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -25,19 +25,18 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('MAXCHILDREN', 2); define('POLL_INTERVAL', 60); // in seconds -$shortoptions = 'i::'; -$longoptions = array('id::'); +$shortoptions = 'di::'; +$longoptions = array('id::', 'debug'); $helptext = <<<END_OF_TRIM_HELP Batch script for retrieving Twitter messages from foreign service. - -i --id Identity (default 'generic') + -i --id Identity (default 'generic') + -d --debug Debug (lots of log output) END_OF_TRIM_HELP; -require_once INSTALLDIR.'/scripts/commandline.inc'; - -require_once INSTALLDIR . '/lib/common.php'; +require_once INSTALLDIR .'/scripts/commandline.inc'; require_once INSTALLDIR . '/lib/daemon.php'; /** @@ -89,6 +88,11 @@ class TwitterStatusFetcher extends Daemon function run() { + if (defined('SCRIPT_DEBUG')) { + common_debug($this->name() . + ': debugging log output enabled.'); + } + do { $flinks = $this->refreshFlinks(); @@ -649,7 +653,9 @@ if (have_option('i')) { $id = null; } -common_debug("id set to $id"); +if (have_option('d') || have_option('debug')) { + define('SCRIPT_DEBUG', true); +} $fetcher = new TwitterStatusFetcher($id); $fetcher->runOnce(); |