Skip to content

Commit

Permalink
Don't overwrite log targets
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Apr 24, 2024
1 parent 463ea47 commit 09c617d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
7 changes: 7 additions & 0 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use craft\db\Table;
use craft\helpers\App;
use craft\helpers\ConfigHelper;
use craft\log\MonologTarget;
use craft\queue\Queue as CraftQueue;
use GuzzleHttp\Psr7\Request;
use HttpSignatures\Context;
Expand Down Expand Up @@ -146,6 +147,12 @@ public static function modifyConfig(array &$config, string $appType): void

return Craft::createObject($config);
};

$config['container']['definitions'] = [
MonologTarget::class => [
'logContext' => false,
],
];
}

public static function createSigningContext(iterable $headers = []): Context
Expand Down
18 changes: 0 additions & 18 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
use craft\helpers\App;
use craft\imagetransforms\FallbackTransformer;
use craft\imagetransforms\ImageTransformer as CraftImageTransformer;
use craft\log\Dispatcher;
use craft\log\MonologTarget;
use craft\services\Elements;
use craft\services\Fs as FsService;
use craft\services\ImageTransforms;
Expand All @@ -31,7 +29,6 @@
use craft\web\View;
use Illuminate\Support\Collection;
use yii\base\InvalidConfigException;
use yii\log\Target;

/**
* @property ?string $id When auto-bootstrapped as an extension, this can be `null`.
Expand Down Expand Up @@ -135,21 +132,6 @@ protected function bootstrapCloud(ConsoleApplication|WebApplication $app): void
->all();
}

/** @var Dispatcher $dispatcher */
$dispatcher = $app->getLog();
$dispatcher->targets = Collection::make($dispatcher->getTargets())
->map(function(Target $target) {
if (!($target instanceof MonologTarget)) {
return $target;
}

return Craft::configure($target, [
'logContext' => false,
]);
})
->all();


Craft::$container->set(
Temp::class,
TmpFs::class,
Expand Down

0 comments on commit 09c617d

Please sign in to comment.