Browse Source

add function for logger to bypass not being setup yet

CauseFX 4 years ago
parent
commit
2c345b27dc

+ 53 - 39
api/classes/organizr.class.php

@@ -248,7 +248,8 @@ class Organizr
 			$currentIP = $this->userIP();
 			if ($this->config['blacklisted'] !== '') {
 				if (in_array($currentIP, $this->arrayIP($this->config['blacklisted']))) {
-					$this->setLoggerChannel('Authentication')->debug('User was sent to black hole', $this->config['blacklisted']);
+					$this->setLoggerChannel('Authentication');
+					$this->debug('User was sent to black hole', $this->config['blacklisted']);
 					die($this->showHTML('Blacklisted', $this->config['blacklistedMessage']));
 				}
 			}
@@ -954,7 +955,8 @@ class Organizr
 			// Update config.php version if different to the installed version
 			if ($updateSuccess && $this->version !== $this->config['configVersion']) {
 				$this->updateConfig(array('apply_CONFIG_VERSION' => $this->version));
-				$this->setLoggerChannel('Update')->debug('Updated config version to ' . $this->version);
+				$this->setLoggerChannel('Update');
+				$this->debug('Updated config version to ' . $this->version);
 			}
 			if ($updateSuccess == false) {
 				die($this->showHTML('Database update failed', 'Please manually check logs and fix - Then reload this page'));
@@ -1381,7 +1383,8 @@ class Organizr
 	{
 		if (isset($_COOKIE[$this->cookieName])) {
 			if ($token == $_COOKIE[$this->cookieName]) {
-				$this->setLoggerChannel('Authentication')->debug('Token was invalid - deleting cookie and user session');
+				$this->setLoggerChannel('Authentication');
+				$this->debug('Token was invalid - deleting cookie and user session');
 				$this->coookie('delete', $this->cookieName);
 				$this->user = null;
 			}
@@ -1398,7 +1401,8 @@ class Organizr
 			$user = $this->getUserById($userInfo['userID']);
 			$tokenCheck = ($this->searchArray($allTokens, 'token', $token) !== false);
 			if (!$tokenCheck) {
-				$this->setLoggerChannel('Authentication')->debug('Token failed check against all token listings', $allTokens);
+				$this->setLoggerChannel('Authentication');
+				$this->debug('Token failed check against all token listings', $allTokens);
 				$this->invalidToken($token);
 				if ($api) {
 					$this->setResponse(403, 'Token was not in approved list');
@@ -1429,7 +1433,8 @@ class Organizr
 			if ($api) {
 				$this->setResponse(403, 'Token was invalid');
 			}
-			$this->setLoggerChannel('Authentication')->debug('User  token was invalid', $token);
+			$this->setLoggerChannel('Authentication');
+			$this->debug('User  token was invalid', $token);
 			$this->invalidToken($token);
 		}
 		if ($api) {
@@ -3722,7 +3727,8 @@ class Organizr
 	
 	public function createToken($username, $email, $days = 1)
 	{
-		$this->setLoggerChannel('Authentication', $username)->debug('Starting token creation function');
+		$this->setLoggerChannel('Authentication', $username);
+		$this->debug('Starting token creation function');
 		$days = ($days > 365) ? 365 : $days;
 		//Quick get user ID
 		$result = $this->getUserByUsernameAndEmail($username, $email);
@@ -3766,7 +3772,7 @@ class Organizr
 			),
 		];
 		$token = $this->processQueries($response);
-		$this->logger->debug('Token creation function has finished');
+		$this->debug('Token creation function has finished');
 		return $jwttoken;
 		
 	}
@@ -3786,7 +3792,7 @@ class Organizr
 		$days = (isset($remember)) ? $this->config['rememberMeDays'] : 1;
 		// Set logger channel
 		$this->setLoggerChannel('Authentication', $username);
-		$this->logger->debug('Starting login function');
+		$this->debug('Starting login function');
 		// Set  other variables
 		$function = 'plugin_auth_' . $this->config['authBackend'];
 		$authSuccess = false;
@@ -3795,7 +3801,7 @@ class Organizr
 		// Check Login attempts and kill if over limit
 		if ($loginAttempts > $this->config['loginAttempts'] || isset($_COOKIE['lockout'])) {
 			$this->coookieSeconds('set', 'lockout', $this->config['loginLockout'], $this->config['loginLockout']);
-			$this->logger->warning('User is locked out');
+			$this->warning('User is locked out');
 			$this->setAPIResponse('error', 'User is locked out', 403);
 			return false;
 		}
@@ -3805,16 +3811,16 @@ class Organizr
 				$usernameHeader = $this->getallheaders()[$this->config['authProxyHeaderName']] ?? $username;
 				$emailHeader = $this->getallheaders()[$this->config['authProxyHeaderNameEmail']] ?? null;
 				$this->setLoggerChannel('Authentication', $usernameHeader);
-				$this->logger->debug('Starting Auth Proxy verification');
+				$this->debug('Starting Auth Proxy verification');
 				$whitelistRange = $this->analyzeIP($this->config['authProxyWhitelist']);
 				$authProxy = $this->authProxyRangeCheck($whitelistRange['from'], $whitelistRange['to']);
 				$username = ($authProxy) ? $usernameHeader : $username;
 				$password = ($password == null) ? $this->random_ascii_string(10) : $password;
 				$addEmailToAuthProxy = ($authProxy && $emailHeader) ? ['email' => $emailHeader] : true;
 				if ($authProxy) {
-					$this->logger->info('User has been verified using Auth Proxy');
+					$this->info('User has been verified using Auth Proxy');
 				} else {
-					$this->logger->warning('User has failed verification using Auth Proxy');
+					$this->warning('User has failed verification using Auth Proxy');
 				}
 			}
 		}
@@ -3839,7 +3845,7 @@ class Organizr
 					if (!$authSuccess) {
 						// perform the internal authentication step
 						if (password_verify($password, $result['password'])) {
-							$this->logger->debug('User password has been verified');
+							$this->debug('User password has been verified');
 							$authSuccess = true;
 						}
 					}
@@ -3850,7 +3856,7 @@ class Organizr
 			switch ($oAuthType) {
 				case 'plex':
 					if ($this->config['plexoAuth']) {
-						$this->logger->debug('Starting Plex oAuth verification');
+						$this->debug('Starting Plex oAuth verification');
 						$tokenInfo = $this->checkPlexToken($oAuth);
 						if ($tokenInfo) {
 							$authSuccess = array(
@@ -3860,14 +3866,14 @@ class Organizr
 								'token' => $tokenInfo['user']['authToken'],
 								'oauth' => 'plex'
 							);
-							$this->logger->debug('User\'s Plex Token has been verified');
+							$this->debug('User\'s Plex Token has been verified');
 							$this->coookie('set', 'oAuth', 'true', $this->config['rememberMeDays']);
 							$authSuccess = ((!empty($this->config['plexAdmin']) && strtolower($this->config['plexAdmin']) == strtolower($tokenInfo['user']['username'])) || (!empty($this->config['plexAdmin']) && strtolower($this->config['plexAdmin']) == strtolower($tokenInfo['user']['email'])) || $this->checkPlexUser($tokenInfo['user']['username'])) ? $authSuccess : false;
 						} else {
-							$this->logger->warning('User\'s Plex Token has failed verification');
+							$this->warning('User\'s Plex Token has failed verification');
 						}
 					} else {
-						$this->logger->debug('Plex oAuth is not setup');
+						$this->debug('Plex oAuth is not setup');
 						$this->setAPIResponse('error', 'Plex oAuth is not setup', 422);
 						return false;
 					}
@@ -3893,12 +3899,14 @@ class Organizr
 				//does org password need to be updated
 				if (!$passwordMatches) {
 					$this->updateUserPassword($password, $result['id']);
-					$this->setLoggerChannel('Authentication', $username)->info('User Password updated from backend');
+					$this->setLoggerChannel('Authentication', $username);
+					$this->info('User Password updated from backend');
 				}
 				if ($token !== '') {
 					if ($token !== $result['plex_token']) {
 						$this->updateUserPlexToken($token, $result['id']);
-						$this->setLoggerChannel('Authentication', $username)->info('User Plex Token updated from backend');
+						$this->setLoggerChannel('Authentication', $username);
+						$this->info('User Plex Token updated from backend');
 					}
 				}
 				// 2FA might go here
@@ -3917,55 +3925,58 @@ class Organizr
 						}
 					}
 					if ($tfaProceed) {
-						$this->setLoggerChannel('Authentication', $username)->debug('Starting 2FA verification');
+						$this->setLoggerChannel('Authentication', $username);
+						$this->debug('Starting 2FA verification');
 						$TFA = explode('::', $result['auth_service']);
 						// Is code with login info?
 						if ($tfaCode == '') {
-							$this->logger->debug('Sending 2FA response to login UI');
+							$this->debug('Sending 2FA response to login UI');
 							$this->setAPIResponse('warning', '2FA Code Needed', 422);
 							return false;
 						} else {
 							if (!$this->verify2FA($TFA[1], $tfaCode, $TFA[0])) {
-								$this->logger->warning('Incorrect 2FA');
+								$this->warning('Incorrect 2FA');
 								$this->setAPIResponse('error', 'Wrong 2FA', 422);
 								return false;
 							} else {
-								$this->logger->info('2FA verification passed');
+								$this->info('2FA verification passed');
 							}
 						}
 					}
 				}
 				// End 2FA
 				// authentication passed - 1) mark active and update token
-				$this->logger->debug('Starting token creation function');
+				$this->debug('Starting token creation function');
 				$createToken = $this->createToken($result['username'], $result['email'], $days);
 				if ($createToken) {
-					$this->logger->debug('Token has been created');
-					$this->logger->debug('Token creation function has finished');
-					$this->logger->info('User has logged in');
-					$this->logger->debug('Starting SSO check function');
+					$this->debug('Token has been created');
+					$this->debug('Token creation function has finished');
+					$this->info('User has logged in');
+					$this->debug('Starting SSO check function');
 					$this->ssoCheck($result, $password, $token); //need to work on this
 					return ($output) ? array('name' => $this->cookieName, 'token' => (string)$createToken) : true;
 				} else {
-					$this->logger->warning('Token creation error');
+					$this->warning('Token creation error');
 					$this->setAPIResponse('error', 'Token creation error', 500);
 					return false;
 				}
 			} else {
 				// Create User
-				$this->setLoggerChannel('Authentication', (is_array($authSuccess) && isset($authSuccess['username']) ? $authSuccess['username'] : $username))->debug('Starting Registration function');
+				$this->setLoggerChannel('Authentication', (is_array($authSuccess) && isset($authSuccess['username']) ? $authSuccess['username'] : $username));
+				$this->debug('Starting Registration function');
 				return $this->authRegister((is_array($authSuccess) && isset($authSuccess['username']) ? $authSuccess['username'] : $username), $password, (is_array($authSuccess) && isset($authSuccess['email']) ? $authSuccess['email'] : ''), $token);
 			}
 		} else {
 			// authentication failed
-			$this->setLoggerChannel('Authentication', $username)->warning('Wrong Password');
+			$this->setLoggerChannel('Authentication', $username);
+			$this->warning('Wrong Password');
 			if ($loginAttempts >= $this->config['loginAttempts']) {
-				$this->logger->warning('User exceeded maximum login attempts');
+				$this->warning('User exceeded maximum login attempts');
 				$this->coookieSeconds('set', 'lockout', $this->config['loginLockout'], $this->config['loginLockout']);
 				$this->setAPIResponse('error', 'User is locked out', 403);
 				return false;
 			} else {
-				$this->logger->debug('User has not exceeded maximum login attempts');
+				$this->debug('User has not exceeded maximum login attempts');
 				$this->setAPIResponse('error', 'User credentials incorrect', 401);
 				return false;
 			}
@@ -3975,8 +3986,8 @@ class Organizr
 	public function logout()
 	{
 		$this->setLoggerChannel('Authentication');
-		$this->logger->debug('Starting log out process');
-		$this->logger->info('User has logged out');
+		$this->debug('Starting log out process');
+		$this->info('User has logged out');
 		$this->coookie('delete', $this->cookieName);
 		$this->coookie('delete', 'mpt');
 		$this->coookie('delete', 'Auth');
@@ -3987,7 +3998,7 @@ class Organizr
 		$this->clearJellyfinTokens();
 		$this->revokeTokenCurrentUser($this->user['token']);
 		$this->clearKomgaToken();
-		$this->logger->debug('Log out process has finished');
+		$this->debug('Log out process has finished');
 		$this->user = null;
 		return true;
 	}
@@ -7219,7 +7230,8 @@ class Organizr
 				'options' => $options,
 				'data' => $apiData
 			];
-			$this->setLoggerChannel('Socks')->debug('Sending Socks request', $debugInformation);
+			$this->setLoggerChannel('Socks');
+			$this->debug('Sending Socks request', $debugInformation);
 			try {
 				switch ($requestObject->getMethod()) {
 					case 'GET':
@@ -7240,7 +7252,8 @@ class Organizr
 				return $call->body;
 			} catch (Requests_Exception $e) {
 				$this->setAPIResponse('error', $e->getMessage(), 500);
-				$this->setLoggerChannel('Socks')->critical($e, $debugInformation);
+				$this->setLoggerChannel('Socks');
+				$this->critical($e, $debugInformation);
 				return null;
 			}
 		} else {
@@ -7410,7 +7423,8 @@ class Organizr
 				}
 			}
 		} catch (Exception $e) {
-			$this->setLoggerChannel('Database')->logger->critical($e, $request);
+			$this->setLoggerChannel('Database');
+			$this->critical($e, $request);
 			return false;
 		}
 		return count($request) > 1 ? $results : $results[$firstKey];

+ 121 - 82
api/functions/log-functions.php

@@ -2,24 +2,60 @@
 
 trait LogFunctions
 {
-	public function info($msg, $username = null)
+	public function debug($msg, $context = [])
 	{
-		$this->writeLog('info', $msg, $username);
+		if ($this->logger) {
+			$this->logger->debug($msg, $context);
+		}
+	}
+	
+	public function info($msg, $context = [])
+	{
+		if ($this->logger) {
+			$this->logger->info($msg, $context);
+		}
+	}
+	
+	public function notice($msg, $context = [])
+	{
+		if ($this->logger) {
+			$this->logger->notice($msg, $context);
+		}
+	}
+	
+	public function warning($msg, $context = [])
+	{
+		if ($this->logger) {
+			$this->logger->warning($msg, $context);
+		}
 	}
 	
-	public function error($msg, $username = null)
+	public function error($msg, $context = [])
 	{
-		$this->writeLog('error', $msg, $username);
+		if ($this->logger) {
+			$this->logger->error($msg, $context);
+		}
 	}
 	
-	public function warning($msg, $username = null)
+	public function critical($msg, $context = [])
 	{
-		$this->writeLog('warning', $msg, $username);
+		if ($this->logger) {
+			$this->logger->critical($msg, $context);
+		}
 	}
 	
-	public function debug($msg, $username = null)
+	public function alert($msg, $context = [])
 	{
-		$this->writeLog('debug', $msg, $username);
+		if ($this->logger) {
+			$this->logger->alert($msg, $context);
+		}
+	}
+	
+	public function emergency($msg, $context = [])
+	{
+		if ($this->logger) {
+			$this->logger->emergency($msg, $context);
+		}
 	}
 	
 	public function setOrganizrLog()
@@ -140,81 +176,84 @@ trait LogFunctions
 	
 	public function setLoggerChannel($channel = 'Organizr', $username = null)
 	{
-		$setLogger = false;
-		if ($this->logger) {
-			if ($channel) {
-				if (strtolower($this->logger->getChannel()) !== strtolower($channel)) {
-					$setLogger = true;
+		if ($this->hasDB()) {
+			$setLogger = false;
+			if ($this->logger) {
+				if ($channel) {
+					if (strtolower($this->logger->getChannel()) !== strtolower($channel)) {
+						$setLogger = true;
+					}
 				}
-			}
-			if ($username) {
-				if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {
-					$setLogger = true;
+				if ($username) {
+					if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {
+						$setLogger = true;
+					}
 				}
+			} else {
+				$setLogger = true;
+			}
+			if ($setLogger) {
+				$channel = $channel ?: 'Organizr';
+				$this->setupLogger($channel, $username);
 			}
-		} else {
-			$setLogger = true;
-		}
-		if ($setLogger) {
-			$channel = $channel ?: 'Organizr';
-			$this->setupLogger($channel, $username);
 		}
-		return $this->logger;
 	}
 	
 	public function setupLogger($channel = 'Organizr', $username = null)
 	{
-		if ($this->log) {
-			if (!$username) {
-				$username = $this->user['username'] ?? 'System';
-			}
-			$loggerBuilder = new Nekonomokochan\PhpJsonLogger\LoggerBuilder();
-			$loggerBuilder->setMaxFiles($this->config['maxLogFiles']);
-			$loggerBuilder->setFileName($this->log);
-			$loggerBuilder->setTraceId($username);
-			$loggerBuilder->setChannel(ucwords(strtolower($channel)));
-			switch ($this->config['logLevel']) {
-				case 'DEBUG':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::DEBUG;
-					break;
-				case 'INFO':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::INFO;
-					break;
-				case 'NOTICE':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::NOTICE;
-					break;
-				case 'ERROR':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::ERROR;
-					break;
-				case 'CRITICAL':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::CRITICAL;
-					break;
-				case 'ALERT':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::ALERT;
-					break;
-				case 'EMERGENCY':
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::EMERGENCY;
-					break;
-				default:
-					$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::WARNING;
-					break;
-			}
-			$loggerBuilder->setLogLevel($logLevel);
-			try {
-				$this->logger = $loggerBuilder->build();
-			} catch (Exception $e) {
-				// nothing so far
+		if ($this->hasDB()) {
+			if ($this->log) {
+				if (!$username) {
+					$username = $this->user['username'] ?? 'System';
+				}
+				$loggerBuilder = new Nekonomokochan\PhpJsonLogger\LoggerBuilder();
+				$loggerBuilder->setMaxFiles($this->config['maxLogFiles']);
+				$loggerBuilder->setFileName($this->log);
+				$loggerBuilder->setTraceId($username);
+				$loggerBuilder->setChannel(ucwords(strtolower($channel)));
+				switch ($this->config['logLevel']) {
+					case 'DEBUG':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::DEBUG;
+						break;
+					case 'INFO':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::INFO;
+						break;
+					case 'NOTICE':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::NOTICE;
+						break;
+					case 'ERROR':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::ERROR;
+						break;
+					case 'CRITICAL':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::CRITICAL;
+						break;
+					case 'ALERT':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::ALERT;
+						break;
+					case 'EMERGENCY':
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::EMERGENCY;
+						break;
+					default:
+						$logLevel = Nekonomokochan\PhpJsonLogger\LoggerBuilder::WARNING;
+						break;
+				}
+				$loggerBuilder->setLogLevel($logLevel);
+				try {
+					$this->logger = $loggerBuilder->build();
+				} catch (Exception $e) {
+					// nothing so far
+				}
+				/* setup:
+				set the log channel before you send log (You can set an optional Username (2nd Variable) | If user is logged already logged in, it will use their username):
+				$this->setLoggerChannel('Plex Homepage');
+				normal log:
+				$this->info('test');
+				normal log with context ($context must be an array):
+				$this->info('test', $context);
+				exception:
+				$this->critical($exception, $context);
+				*/
 			}
-			/* setup:
-			set the log channel before you send log (You can set an optional Username (2nd Variable) | If user is logged already logged in, it will use their username):
-			$this->setLoggerChannel('Plex Homepage');
-			normal log:
-			$this->logger->info('test');
-			normal log with context ($context must be an array):
-			$this->logger->info('test', $context);
-			exception:
-			$this->logger->critical($exception, $context);
-			*/
 		}
 	}
 	
@@ -244,9 +283,9 @@ trait LogFunctions
 	public function purgeLog($number)
 	{
 		$this->setLoggerChannel('Logger');
-		$this->logger->debug('Starting log purge function');
+		$this->debug('Starting log purge function');
 		if ($this->log) {
-			$this->logger->debug('Checking if log id exists');
+			$this->debug('Checking if log id exists');
 			if ($number !== 0) {
 				$logs = $this->getLogFiles();
 				$file = $logs[$number] ?? false;
@@ -259,21 +298,21 @@ trait LogFunctions
 			}
 			preg_match('/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/', $file, $log);
 			$log = $log[0];
-			$this->logger->debug('Checking if log exists');
+			$this->debug('Checking if log exists');
 			if (file_exists($file)) {
-				$this->logger->debug('Log: ' . $log . ' does exist');
-				$this->logger->debug('Attempting to purge log: ' . $log);
+				$this->debug('Log: ' . $log . ' does exist');
+				$this->debug('Attempting to purge log: ' . $log);
 				if (unlink($file)) {
-					$this->logger->info('Log: ' . $log . ' has been purged/deleted');
+					$this->info('Log: ' . $log . ' has been purged/deleted');
 					$this->setAPIResponse(null, 'Log purged');
 					return true;
 				} else {
-					$this->logger->warning('Log: ' . $log . ' could not be purged/deleted');
+					$this->warning('Log: ' . $log . ' could not be purged/deleted');
 					$this->setAPIResponse('error', 'Log could not be purged', 500);
 					return false;
 				}
 			} else {
-				$this->logger->debug('Log does not exist');
+				$this->debug('Log does not exist');
 				$this->setAPIResponse('error', 'Log does not exist', 404);
 				return false;
 			}

+ 2 - 1
api/homepage/plex.php

@@ -675,7 +675,8 @@ trait PlexHomepageItem
 			if ($names !== $this->config['homepageCustomStreamNames']) {
 				$this->updateConfig(array('homepageCustomStreamNames' => $names));
 				$this->config['homepageCustomStreamNames'] = $names;
-				$this->setLoggerChannel('Tautulli')->debug('Updating Tautulli custom names config item', $names);
+				$this->setLoggerChannel('Tautulli');
+				$this->debug('Updating Tautulli custom names config item', $names);
 			}
 		}
 	}

+ 9 - 9
api/homepage/sabnzbd.php

@@ -50,7 +50,7 @@ trait SabNZBdHomepageItem
 	public function testConnectionSabNZBd()
 	{
 		$this->setLoggerChannel('Sabnzbd Homepage');
-		$this->logger->debug('Starting API Connection Test');
+		$this->debug('Starting API Connection Test');
 		if (!empty($this->config['sabnzbdURL']) && !empty($this->config['sabnzbdToken'])) {
 			$url = $this->qualifyURL($this->config['sabnzbdURL']);
 			$url = $url . '/api?mode=queue&output=json&apikey=' . $this->config['sabnzbdToken'];
@@ -68,20 +68,20 @@ trait SabNZBdHomepageItem
 						$message = $data['error'];
 					}
 					$this->setAPIResponse($status, $message, $responseCode, $data);
-					$this->logger->debug('API Connection Test was successful');
+					$this->debug('API Connection Test was successful');
 					return true;
 				} else {
 					$this->setAPIResponse('error', $response->body, 500);
-					$this->logger->debug('API Connection Test was unsuccessful');
+					$this->debug('API Connection Test was unsuccessful');
 					return false;
 				}
 			} catch (Requests_Exception $e) {
-				$this->logger->critical($e, [$url]);
+				$this->critical($e, [$url]);
 				$this->setAPIResponse('error', $e->getMessage(), 500);
 				return false;
 			}
 		} else {
-			$this->logger->debug('URL and/or Token not setup');
+			$this->debug('URL and/or Token not setup');
 			$this->setAPIResponse('error', 'URL and/or Token not setup', 422);
 			return 'URL and/or Token not setup';
 		}
@@ -140,7 +140,7 @@ trait SabNZBdHomepageItem
 				$api['content']['queueItems'] = json_decode($response->body, true);
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};
@@ -153,7 +153,7 @@ trait SabNZBdHomepageItem
 				$api['content']['historyItems'] = json_decode($response->body, true);
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};
@@ -178,7 +178,7 @@ trait SabNZBdHomepageItem
 				$api['content'] = json_decode($response->body, true);
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};
@@ -203,7 +203,7 @@ trait SabNZBdHomepageItem
 				$api['content'] = json_decode($response->body, true);
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};

+ 2 - 2
api/homepage/tautulli.php

@@ -89,7 +89,7 @@ trait TautulliHomepageItem
 				return false;
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		}
@@ -217,7 +217,7 @@ trait TautulliHomepageItem
 				}
 			}
 		} catch (Requests_Exception $e) {
-			$this->logger->critical($e, [$url]);
+			$this->critical($e, [$url]);
 			$this->setAPIResponse('error', $e->getMessage(), 500);
 			return false;
 		};

+ 2 - 1
api/pages/settings.php

@@ -11,7 +11,8 @@ function get_page_settings($Organizr)
 	if (!$Organizr->qualifyRequest(1, true)) {
 		return false;
 	}
-	$Organizr->setLoggerChannel('Organizr')->info('Accessed admin settings page');
+	$Organizr->setLoggerChannel('Organizr');
+	$Organizr->info('Accessed admin settings page');
 	$systemMenus = $Organizr->systemMenuLists();
 	return $Organizr->pluginFiles('js', true) . $Organizr->loadJavascriptFile('js/Sortable.min.js') . '
 <script>