Skip to content

Commit

Permalink
fix(http): use default log config only if no config is provided (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
aazsamir authored Nov 12, 2024
1 parent ccc1ece commit fbaf866
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/Tempest/Console/src/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ public static function boot(
$consoleConfig->name = $name;

$logConfig = $container->get(LogConfig::class);
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log'));

if (
$logConfig->debugLogPath === null
&& $logConfig->channels === []
) {
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log'));
}

return $application;
}
Expand Down
13 changes: 10 additions & 3 deletions src/Tempest/Http/src/HttpApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ public static function boot(

// Application-specific setup
$logConfig = $container->get(LogConfig::class);
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
$logConfig->serverLogPath = env('SERVER_LOG');
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log'));

if (
$logConfig->debugLogPath === null
&& $logConfig->serverLogPath === null
&& $logConfig->channels === []
) {
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
$logConfig->serverLogPath = env('SERVER_LOG');
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log'));
}

return $application;
}
Expand Down

0 comments on commit fbaf866

Please # to comment.