mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 09:54:44 +02:00
Use logger helper
This commit is contained in:
parent
80d3827e4e
commit
80c5a97038
@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands\Schedule;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Services\Schedules\ProcessScheduleService;
|
||||
|
||||
@ -66,7 +64,7 @@ class ProcessRunnableCommand extends Command
|
||||
'hash' => $schedule->hashid,
|
||||
]));
|
||||
} catch (\Throwable|\Exception $exception) {
|
||||
Log::error($exception, ['schedule_id' => $schedule->id]);
|
||||
logger()->error($exception, ['schedule_id' => $schedule->id]);
|
||||
|
||||
$this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage());
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Exceptions\Http\Connection;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use App\Exceptions\DisplayException;
|
||||
|
||||
@ -70,7 +69,7 @@ class DaemonConnectionException extends DisplayException
|
||||
*/
|
||||
public function report()
|
||||
{
|
||||
Log::{$this->getErrorLevel()}($this->getPrevious(), [
|
||||
logger()->{$this->getErrorLevel()}($this->getPrevious(), [
|
||||
'request_id' => $this->requestId,
|
||||
]);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ namespace App\Helpers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Cron\CronExpression;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\ViewErrorBag;
|
||||
|
||||
class Utilities
|
||||
@ -26,7 +25,7 @@ class Utilities
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
// Just log the error and hope for the best at this point.
|
||||
Log::error($exception);
|
||||
logger()->error($exception);
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
@ -7,7 +7,6 @@ use App\Models\Server;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Facades\Activity;
|
||||
use App\Models\Permission;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Services\Subusers\SubuserCreationService;
|
||||
use App\Repositories\Daemon\DaemonServerRepository;
|
||||
use App\Transformers\Api\Client\SubuserTransformer;
|
||||
@ -115,7 +114,7 @@ class SubuserController extends ClientApiController
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
// Don't block this request if we can't connect to the daemon instance. Chances are it is
|
||||
// offline and the token will be invalid once daemon boots back.
|
||||
Log::warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]);
|
||||
logger()->warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]);
|
||||
|
||||
$instance->property('revoked', false);
|
||||
}
|
||||
@ -149,7 +148,7 @@ class SubuserController extends ClientApiController
|
||||
$this->serverRepository->setServer($server)->revokeUserJTI($subuser->user_id);
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
// Don't block this request if we can't connect to the daemon instance.
|
||||
Log::warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]);
|
||||
logger()->warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]);
|
||||
|
||||
$instance->property('revoked', false);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use Illuminate\Support\Str;
|
||||
use App\Models\User;
|
||||
use Webmozart\Assert\Assert;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\ActivityLogSubject;
|
||||
use App\Http\Controllers\Controller;
|
||||
@ -40,7 +39,7 @@ class ActivityProcessingController extends Controller
|
||||
'UTC'
|
||||
);
|
||||
} catch (\Exception $exception) {
|
||||
Log::warning($exception, ['timestamp' => $datum['timestamp']]);
|
||||
logger()->warning($exception, ['timestamp' => $datum['timestamp']]);
|
||||
|
||||
// If we cannot parse the value for some reason don't blow up this request, just go ahead
|
||||
// and log the event with the current time, and set the metadata value to have the original
|
||||
|
@ -7,7 +7,6 @@ use App\Repositories\Daemon\DaemonServerRepository;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Models\Allocation;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Models\ServerTransfer;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use App\Http\Controllers\Controller;
|
||||
@ -80,7 +79,7 @@ class ServerTransferController extends Controller
|
||||
->setNode($transfer->oldNode)
|
||||
->delete();
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
Log::warning($exception, ['transfer_id' => $server->transfer->id]);
|
||||
logger()->warning($exception, ['transfer_id' => $server->transfer->id]);
|
||||
}
|
||||
|
||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
||||
|
@ -5,7 +5,6 @@ namespace App\Services\Activity;
|
||||
use Illuminate\Support\Arr;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Models\ActivityLog;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
@ -147,7 +146,7 @@ class ActivityLogService
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
Log::error($exception);
|
||||
logger()->error($exception);
|
||||
}
|
||||
|
||||
return $activity;
|
||||
|
@ -4,7 +4,6 @@ namespace App\Services\Nodes;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Node;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use App\Repositories\Daemon\DaemonConfigurationRepository;
|
||||
@ -51,7 +50,7 @@ class NodeUpdateService
|
||||
|
||||
$this->configurationRepository->setNode($node)->update($updated);
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
Log::warning($exception, ['node_id' => $node->id]);
|
||||
logger()->warning($exception, ['node_id' => $node->id]);
|
||||
|
||||
// Never actually throw these exceptions up the stack. If we were able to change the settings
|
||||
// but something went wrong with daemon we just want to store the update and let the user manually
|
||||
|
@ -5,7 +5,6 @@ namespace App\Services\Servers;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Models\Server;
|
||||
use App\Models\Allocation;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use App\Exceptions\DisplayException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
@ -67,7 +66,7 @@ class BuildModificationService
|
||||
try {
|
||||
$this->daemonServerRepository->setServer($server)->sync();
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
Log::warning($exception, ['server_id' => $server->id]);
|
||||
logger()->warning($exception, ['server_id' => $server->id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ namespace App\Services\Servers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use App\Repositories\Daemon\DaemonServerRepository;
|
||||
use App\Services\Databases\DatabaseManagementService;
|
||||
@ -53,7 +52,7 @@ class ServerDeletionService
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
Log::warning($exception);
|
||||
logger()->warning($exception);
|
||||
}
|
||||
|
||||
$this->connection->transaction(function () use ($server) {
|
||||
@ -71,7 +70,7 @@ class ServerDeletionService
|
||||
// handle this better anyways.
|
||||
$database->delete();
|
||||
|
||||
Log::warning($exception);
|
||||
logger()->warning($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user