Skip to content

Commit

Permalink
Issue #405: Added timestamps and friendlier classnames to user log, w…
Browse files Browse the repository at this point in the history
…ith support for full log display
  • Loading branch information
ginatrapani committed Nov 21, 2010
1 parent 39b9da8 commit e8106b9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
9 changes: 7 additions & 2 deletions webapp/_lib/controller/class.CrawlerWebController.php
Expand Up @@ -48,8 +48,13 @@ public function authControl() {

try {
$logger = Logger::getInstance();
$logger->setVerbosity(Logger::USER_MSGS);
$logger->enableHTMLOutput();
if (isset($_GET['log']) && $_GET['log'] == 'full') {
$logger->setVerbosity(Logger::ALL_MSGS);
echo '<pre style="font-family:Courier;font-size:10px;">';
} else {
$logger->setVerbosity(Logger::USER_MSGS);
$logger->enableHTMLOutput();
}
$crawler = Crawler::getInstance();
$crawler->crawl();
$logger->close();
Expand Down
3 changes: 3 additions & 0 deletions webapp/_lib/controller/class.UpdateNowController.php
Expand Up @@ -44,6 +44,9 @@ public function authControl() {
'<code style="font-family:Courier">cd '.THINKUP_WEBAPP_PATH.
'crawler/;export THINKUP_PASSWORD=yourpassword; '.$php_path.' crawl.php '.$this->getLoggedInUser().
'</code>');
if (isset($_GET['log']) && $_GET['log'] == 'full') {
$this->addToView('log', 'full');
}
return $this->generateView();
}
}
8 changes: 7 additions & 1 deletion webapp/_lib/model/class.Logger.php
Expand Up @@ -150,9 +150,15 @@ private function logStatus($status_message, $classname, $verbosity = self::ALL_M
$this->output($status_signature.$status_message); # Write status to log
}
} else {
$message_wrapper = '';
$message_wrapper = '<span style="color:#ccc">'.date("H:i", time()).'</span> ';
$just_classname = explode('::', $classname);
if (isset($just_classname[0])) {
if ( $just_classname[0] == 'CrawlerTwitterAPIAccessorOAuth') {
$just_classname[0] = 'TwitterCrawler';
}
if ( strtoupper(substr ( $just_classname[0] , strlen($just_classname[0])-3, 3 )) == 'DAO') {
$just_classname[0] = 'Database';
}
$message_wrapper .= $just_classname[0].": ";
}
$message_wrapper .= '<span style="color:';
Expand Down
2 changes: 1 addition & 1 deletion webapp/_lib/view/crawler.updatenow.tpl
Expand Up @@ -12,7 +12,7 @@ ThinkUp is updating your data. To see the technical details of what's going on,
This could take awhile. Leave this page open until it's complete.
</p>
<br />
<iframe width="850" height="500" src="run.php" style="border:solid black 1px">
<iframe width="850" height="500" src="run.php{if $log == 'full'}?log=full{/if}" style="border:solid black 1px">
</iframe>
<br /><br />
{include file="_usermessage.tpl"}
Expand Down

0 comments on commit e8106b9

Please sign in to comment.