From 0f28f951a306f7dae1fa273f3150a82672d36e6f Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 28 Jun 2025 11:46:29 +0200 Subject: [PATCH] Extract helpers and other requires --- bin/migrate | 14 +++----------- bootstrap/autoload.php | 26 ++++++++++++++++++++++++++ bootstrap/helpers.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 bootstrap/autoload.php create mode 100644 bootstrap/helpers.php diff --git a/bin/migrate b/bin/migrate index 736533d..a2705a4 100755 --- a/bin/migrate +++ b/bin/migrate @@ -1,15 +1,7 @@ #!/usr/bin/env php getDatabaseManager(), new Filesy if (! $repository->repositoryExists()) { $repository->createRepository(); - echo "Migration table created.\n"; + logger('migration')->info("Migration table created"); } $migrator->run(__DIR__ . '/../database/migrations'); -echo "Migrations complete.\n"; +logger('migration')->info("Migrations completed successfully"); diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php new file mode 100644 index 0000000..1a6f0c8 --- /dev/null +++ b/bootstrap/autoload.php @@ -0,0 +1,26 @@ +pushHandler(new StreamHandler($logsDir . "/{$channel}.log", Logger::INFO)); + $loggers[$channel] = $logger; + } + + return $loggers[$channel]; + } +} \ No newline at end of file