diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-10-07 00:47:11 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-10-07 00:47:22 +0400 |
commit | 6c11ad21c86a3bac8111d5a4c08bc635984d2129 (patch) | |
tree | ff7d27edc8483e65ee0a39f0247e011e1855f843 /misc | |
parent | 57501bfc33ed680cdde8c9177e8dc0ea42005011 (diff) |
Removed Piwik::log and replace with calls to Log::... functions. Also changed logging level on travis.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 5 | ||||
-rwxr-xr-x | misc/others/geoipUpdateRows.php | 35 | ||||
-rw-r--r-- | misc/others/test_generateLotsVisitsWebsites.php | 8 |
3 files changed, 26 insertions, 22 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 40eb2ba1d2..1fdae6d839 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -11,6 +11,7 @@ use Piwik\Plugins\SitesManager\API as APISitesManager; use Piwik\Timer; use Piwik\Url; use Piwik\Version; +use Piwik\Log; $USAGE = " Usage: @@ -355,7 +356,7 @@ class CronArchive $requestsWebsite = $this->requests - $requestsBefore; $debug = $this->shouldArchiveAllWebsites ? ", last days = $visitsAllDays visits" : ""; - Piwik::log("Archived website id = $idsite, today = $visitsToday visits" + Log::info("Archived website id = $idsite, today = $visitsToday visits" . $debug . ", $requestsWebsite API requests, " . $timerWebsite->__toString() . " [" . ($websitesWithVisitsSinceLastRun + $skipped) . "/" @@ -557,7 +558,7 @@ class CronArchive { $this->output .= $m . "\n"; try { - Piwik::log($m); + Log::info($m); } catch(Exception $e) { print($m . "\n"); } diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index 2369f955d8..ff4613ee4a 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -4,6 +4,7 @@ use Piwik\Config; use Piwik\Db; use Piwik\FrontController; use Piwik\IP; +use Piwik\Log; use Piwik\Piwik; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl; use Piwik\Plugins\UserCountry\LocationProvider; @@ -34,7 +35,8 @@ require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; define('PIWIK_ENABLE_DISPATCH', false); -Config::getInstance()->log['logger_message'][] = 'screen'; +Config::getInstance()->log['log_writers'][] = 'screen'; +Config::getInstance()->log['log_level'] = 'VERBOSE'; FrontController::getInstance()->init(); $query = "SELECT count(*) FROM " . Common::prefixTable('log_visit'); @@ -45,7 +47,7 @@ if (!Common::isPhpCliMode()) { try { Piwik::checkUserIsSuperUser(); } catch (Exception $e) { - Piwik::log('[error] You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.'); + Log::error('[error] You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.'); exit; } // the 'start' query param will be supplied by the AJAX requests, so if it's not there, the @@ -111,7 +113,7 @@ if (!Common::isPhpCliMode()) { function geoipUpdateError($message) { - Piwik::log($message); + Log::error($message); if (!Common::isPhpCliMode()) { @header('HTTP/1.1 500 Internal Server Error', $replace = true, $responseCode = 500); } @@ -126,7 +128,7 @@ $displayNotes = $start == 0; $provider = new Pecl(); if (!$provider->isAvailable()) { if ($displayNotes) { - Piwik::log("[note] The GeoIP PECL extension is not installed."); + Log::info("[note] The GeoIP PECL extension is not installed."); } $provider = null; @@ -134,10 +136,10 @@ if (!$provider->isAvailable()) { $workingOrError = $provider->isWorking(); if ($workingOrError !== true) { if ($displayNotes) { - Piwik::log("[note] The GeoIP PECL extension is broken: $workingOrError"); + Log::info("[note] The GeoIP PECL extension is broken: $workingOrError"); } if (Common::isPhpCliMode()) { - Piwik::log("[note] Make sure your command line PHP is configured to use the PECL extension."); + Log::info("[note] Make sure your command line PHP is configured to use the PECL extension."); } $provider = null; } @@ -146,20 +148,20 @@ if (!$provider->isAvailable()) { // use php api if pecl extension cannot be used if (is_null($provider)) { if ($displayNotes) { - Piwik::log("[note] Falling back to PHP API. This may become too slow for you. If so, you can read this link on how to install the PECL extension: http://piwik.org/faq/how-to/#faq_164"); + Log::info("[note] Falling back to PHP API. This may become too slow for you. If so, you can read this link on how to install the PECL extension: http://piwik.org/faq/how-to/#faq_164"); } $provider = new Php(); if (!$provider->isAvailable()) { if ($displayNotes) { - Piwik::log("[note] The GeoIP PHP API is not available. This means you do not have a GeoIP location database in your ./misc directory. The database must be named either GeoIP.dat or GeoIPCity.dat based on the type of database it is."); + Log::info("[note] The GeoIP PHP API is not available. This means you do not have a GeoIP location database in your ./misc directory. The database must be named either GeoIP.dat or GeoIPCity.dat based on the type of database it is."); } $provider = null; } else { $workingOrError = $provider->isWorking(); if ($workingOrError !== true) { if ($displayNotes) { - Piwik::log("[note] The GeoIP PHP API is broken: $workingOrError"); + Log::info("[note] The GeoIP PHP API is broken: $workingOrError"); } $provider = null; } @@ -172,7 +174,7 @@ if (is_null($provider)) { $info = $provider->getInfo(); if ($displayNotes) { - Piwik::log("[note] Found working provider: {$info['id']}"); + Log::info("[note] Found working provider: {$info['id']}"); } // perform update @@ -183,7 +185,7 @@ $logVisitFieldsToUpdate = array('location_country' => LocationProvider::COUNTR 'location_longitude' => LocationProvider::LONGITUDE_KEY); if ($displayNotes) { - Piwik::log("\n$count rows to process in " . Common::prefixTable('log_visit') + Log::info("\n$count rows to process in " . Common::prefixTable('log_visit') . " and " . Common::prefixTable('log_conversion') . "..."); } flush(); @@ -246,12 +248,11 @@ for (; $start < $end; $start += $limit) { WHERE idvisit = ?"; Db::query($sql, $bind); } - Piwik::log(round($start * 100 / $count) . "% done..."); + Log::info(round($start * 100 / $count) . "% done..."); flush(); } if ($start >= $count) { - Piwik::log("100% done!"); - Piwik::log(""); - Piwik::log("[note] Now that you've geolocated your old visits, you need to force your reports to be re-processed. See this FAQ entry: http://piwik.org/faq/how-to/#faq_59"); -} - + Log::info("100% done!"); + Log::info(""); + Log::info("[note] Now that you've geolocated your old visits, you need to force your reports to be re-processed. See this FAQ entry: http://piwik.org/faq/how-to/#faq_59"); +}
\ No newline at end of file diff --git a/misc/others/test_generateLotsVisitsWebsites.php b/misc/others/test_generateLotsVisitsWebsites.php index f2a4ba94b0..77c84cdc4f 100644 --- a/misc/others/test_generateLotsVisitsWebsites.php +++ b/misc/others/test_generateLotsVisitsWebsites.php @@ -3,6 +3,7 @@ use Piwik\Common; use Piwik\Config; use Piwik\FrontController; use Piwik\Piwik; +use Piwik\Log; define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../..")); define('PIWIK_ENABLE_DISPATCH', false); @@ -30,7 +31,8 @@ class Piwik_StressTests_CopyLogs { $config = Config::getInstance(); $config->log['log_only_when_debug_parameter'] = 0; - $config->log['logger_message'] = array("logger_message" => "screen"); + $config->log['log_writers'] = array('screen'); + $config->log['log_level'] = 'VERBOSE'; } function run() @@ -117,7 +119,7 @@ class Piwik_StressTests_CopyLogs function log($m) { - Piwik::log($m); + Log::info($m); } function getVisitsToday() @@ -142,4 +144,4 @@ class Piwik_StressTests_CopyLogs $sql = "SELECT count(*) FROM `" . Common::prefixTable('log_link_visit_action') . "` WHERE idsite >= 1 AND DATE(`server_time`) = CURRENT_DATE;"; return \Zend_Registry::get('db')->fetchOne($sql); } -} +}
\ No newline at end of file |