From ad8ec7de61e76db17ac68920740d997675661c52 Mon Sep 17 00:00:00 2001 From: xu42 Date: Wed, 15 Apr 2020 14:48:13 +0800 Subject: [PATCH] remove log --- src/Daemon/Task/DaemonApolloTask.php | 4 ---- src/Daemon/Task/DaemonTokenTask.php | 14 -------------- src/Daemon/Worker/IntervalTimerWorker.php | 3 --- src/Util/ApolloUtil.php | 1 - src/Util/TokenUtil.php | 7 +------ 5 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/Daemon/Task/DaemonApolloTask.php b/src/Daemon/Task/DaemonApolloTask.php index cac8d24..9e76b49 100644 --- a/src/Daemon/Task/DaemonApolloTask.php +++ b/src/Daemon/Task/DaemonApolloTask.php @@ -11,13 +11,9 @@ class DaemonApolloTask extends BaseComponent public function handle(): void { - LogFacade::info("DaemonApolloTask begin..."); - /** @var ApolloUtil $apollo */ $apollo = self::getContainer()->get('apolloUtil'); $apollo->writeToFile(); - - LogFacade::info("DaemonApolloTask end..."); } } \ No newline at end of file diff --git a/src/Daemon/Task/DaemonTokenTask.php b/src/Daemon/Task/DaemonTokenTask.php index 5ca0bde..6a74f0f 100644 --- a/src/Daemon/Task/DaemonTokenTask.php +++ b/src/Daemon/Task/DaemonTokenTask.php @@ -15,15 +15,11 @@ class DaemonTokenTask extends BaseComponent public function handle(): void { - LogFacade::info("DaemonTokenTask begin..."); - try { $this->process(); } catch (Exception $e) { LogFacade::err("DaemonTokenTask ex..." . $e->getTraceAsString()); } - - LogFacade::info("DaemonTokenTask end..."); } private function process() @@ -31,13 +27,11 @@ private function process() // 1. 从Apollo拉取KdtId List $authorityIds = EnvFacade::get('cloud.auth.kdtid'); if (empty($authorityIds)) { - LogFacade::info("DaemonTokenTask process. the authorityIds empty"); return; } $authorityIdArr = json_decode($authorityIds, true); if (!is_array($authorityIdArr)) { - LogFacade::info("DaemonTokenTask process. the authorityIds decode fail. " . $authorityIds); return; } @@ -45,7 +39,6 @@ private function process() foreach ($authorityIdArr as $authorityId) { try { $key = sprintf(CacheKey::TOKEN, trim($authorityId)); - LogFacade::info("DaemonTokenTask process. the key: " . $key); $this->refreshToken(RedisFacade::get($key)); } catch (Exception $e) { LogFacade::err("DaemonTokenTask process refreshToken ex. authorityId:{$authorityId}, " . $e->getTraceAsString()); @@ -56,16 +49,12 @@ private function process() private function refreshToken($oldTokenStr) { - LogFacade::info("DaemonTokenTask refreshToken. the oldTokenStr is: " . $oldTokenStr); - if (empty($oldTokenStr) || !is_string($oldTokenStr)) { - LogFacade::info("DaemonTokenTask refreshToken. the oldTokenStr valid. " . $oldTokenStr); return; } $oldTokenArr = json_decode($oldTokenStr, true); if (!is_array($oldTokenArr) || !array_key_exists('refresh_token', $oldTokenArr)) { - LogFacade::info("DaemonTokenTask refreshToken. the oldTokenStr decode fail. " . $oldTokenStr); return; } @@ -73,12 +62,9 @@ private function refreshToken($oldTokenStr) EnvFacade::get('opensdk.clientId'), EnvFacade::get('opensdk.clientSecret') ))->refreshToken($oldTokenArr['refresh_token']); - LogFacade::info("DaemonTokenTask refreshToken. newTokenArr", $newTokenArr); - if (is_array($newTokenArr) && array_key_exists('access_token', $newTokenArr)) { $key = sprintf(CacheKey::TOKEN, trim($newTokenArr['authority_id'])); $setResp = RedisFacade::set($key, json_encode($newTokenArr)); - LogFacade::info("DaemonTokenTask refreshToken. redis set: {$setResp}", $newTokenArr); } } diff --git a/src/Daemon/Worker/IntervalTimerWorker.php b/src/Daemon/Worker/IntervalTimerWorker.php index 54ef364..3cae075 100644 --- a/src/Daemon/Worker/IntervalTimerWorker.php +++ b/src/Daemon/Worker/IntervalTimerWorker.php @@ -12,8 +12,6 @@ class IntervalTimerWorker extends BaseComponent public function onWorkerStart($worker) { - LogFacade::info('IntervalTimerWorker.onWorkerStart...'); - /** @var IntervalTimerRegistry $intervalTimerRegistry */ $intervalTimerRegistry = $this->getContainer()->get('intervalTimerRegistry'); @@ -41,7 +39,6 @@ public function onWorkerStart($worker) continue; } - LogFacade::info('IntervalTimerWorker.onWorkerStart.' . $name); Timer::add($timeInterval, $callback, $args, $persistent); } diff --git a/src/Util/ApolloUtil.php b/src/Util/ApolloUtil.php index d63e470..6e5d535 100644 --- a/src/Util/ApolloUtil.php +++ b/src/Util/ApolloUtil.php @@ -67,7 +67,6 @@ private function pull(string $resource): array try { /** @var \YouzanCloudBoot\Http\HttpClientResponse $resp */ $resp = $this->getContainer()->get('httpClient')->get($this->buildHttpUrl($resource), $this->buildHttpHeaders()); - LogFacade::info('ApolloUtil pull, http resp: ' . $resp->getBody()); if (empty($resp->getBodyAsJson()) || !isset($resp->getBodyAsJson()['configurations'])) { return []; } diff --git a/src/Util/TokenUtil.php b/src/Util/TokenUtil.php index bca2f07..7084acb 100644 --- a/src/Util/TokenUtil.php +++ b/src/Util/TokenUtil.php @@ -74,21 +74,16 @@ public function code2Token(string $code, $reties = 3): array */ private function code2TokenProcess(string $code): array { - LogFacade::info("[code2TokenProcess] code:{$code}"); - $tokenArr = (new Token( EnvFacade::get('opensdk.clientId'), EnvFacade::get('opensdk.clientSecret') ))->getToolAppToken($code); - LogFacade::info("[code2TokenProcess] tokenArr", $tokenArr); - if (!is_array($tokenArr) || !isset($tokenArr['access_token'])) { throw new TokenException($tokenArr['message'] ?? 'code2Token fail'); } $key = sprintf(CacheKey::TOKEN, trim($tokenArr['authority_id'])); - $setResp = RedisFacade::set($key, json_encode($tokenArr)); - LogFacade::info("TokenUtil code2TokenProcess. redis set: {$setResp}", $tokenArr); + RedisFacade::set($key, json_encode($tokenArr)); return $tokenArr; }