Bladeren bron

updated komga logger items to new logger

CauseFX 3 jaren geleden
bovenliggende
commit
182a69a129
2 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 3 3
      api/functions/organizr-functions.php
  2. 5 5
      api/functions/sso-functions.php

+ 3 - 3
api/functions/organizr-functions.php

@@ -754,12 +754,12 @@ trait OrganizrFunctions
 				$options = $this->requestOptions($url, 60000, true, false);
 				$response = Requests::post($url . '/api/v1/users/logout', ['X-Auth-Token' => $_COOKIE['komga_token']], $options);
 				if ($response->success) {
-					$this->writeLog('success', 'Komga Token Function - Logged User out', 'SYSTEM');
+					$this->setLoggerChannel('Komga')->info('Logged User out');
 				} else {
-					$this->writeLog('error', 'Komga Token Function - Unable to Logged User out', 'SYSTEM');
+					$this->setLoggerChannel('Komga')->warning('Unable to Logged User out');
 				}
 			} catch (Requests_Exception $e) {
-				$this->writeLog('error', 'Komga Token Function - Error: ' . $e->getMessage(), 'SYSTEM');
+				$this->setLoggerChannel('Komga')->error($e);
 			}
 			$this->coookie('delete', 'komga_token');
 		}

+ 5 - 5
api/functions/sso-functions.php

@@ -125,20 +125,20 @@ trait SSOFunctions
 			$response = Requests::get($url . '/api/v1/users/me', ['X-Auth-Token' => 'organizrSSO'], $options);
 			if ($response->success) {
 				if ($response->headers['x-auth-token']) {
-					$this->writeLog('success', 'Komga Token Function - Grabbed token.', $email);
+					$this->setLoggerChannel('Komga')->info('Grabbed token');
 					$token = $response->headers['x-auth-token'];
 				} else {
-					$this->writeLog('error', 'Komga Token Function - Komga did not return Token', $email);
+					$this->setLoggerChannel('Komga')->warning('Komga did not return Token');
 				}
 			} else {
 				if ($fallback) {
-					$this->writeLog('error', 'Komga Token Function - Komga did not return Token - Will retry using fallback credentials', $email);
+					$this->setLoggerChannel('Komga')->warning('Komga did not return Token - Will retry using fallback credentials');
 				} else {
-					$this->writeLog('error', 'Komga Token Function - Komga did not return Token', $email);
+					$this->setLoggerChannel('Komga')->warning('Komga did not return Token');
 				}
 			}
 		} catch (Requests_Exception $e) {
-			$this->writeLog('error', 'Komga Token Function - Error: ' . $e->getMessage(), $email);
+			$this->setLoggerChannel('Komga')->error($e);
 		}
 		if ($token) {
 			return $token;