-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify configuration, logging creation (#67)
* Simplify configuration, logging creation * Change test to use logging test handler * Check for exception output correctly
- Loading branch information
Showing
18 changed files
with
172 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Labrador\DummyApp; | ||
|
||
use Cspray\AnnotatedContainer\Attribute\Service; | ||
use Labrador\Logging\LoggerType; | ||
use Labrador\Logging\MonologLoggerInitializer; | ||
use Monolog\Handler\TestHandler; | ||
use Monolog\Logger; | ||
use Monolog\Processor\PsrLogMessageProcessor; | ||
|
||
#[Service] | ||
class DummyMonologInitializer implements MonologLoggerInitializer { | ||
|
||
public function __construct( | ||
public readonly TestHandler $testHandler | ||
) {} | ||
|
||
public function initialize(Logger $logger, LoggerType $loggerType) : void { | ||
$logger->pushProcessor(new PsrLogMessageProcessor()); | ||
$logger->pushHandler($this->testHandler); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Labrador\Logging; | ||
|
||
use Cspray\AnnotatedContainer\Attribute\ServiceDelegate; | ||
use Psr\Log\LoggerInterface; | ||
|
||
class ApplicationLoggerProvider { | ||
|
||
#[ServiceDelegate] | ||
public static function createLogger(LoggerFactory $loggerFactory) : LoggerInterface { | ||
return $loggerFactory->createLogger(LoggerType::Application); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Labrador\Test\Helper; | ||
|
||
use Amp\Http\Server\Session\SessionMiddleware; | ||
use Labrador\Web\Application\ApplicationFeatures; | ||
use Labrador\Web\Application\StaticAssetSettings; | ||
|
||
class StubApplicationFeatures implements ApplicationFeatures { | ||
|
||
public function getSessionMiddleware() : ?SessionMiddleware { | ||
return null; | ||
} | ||
|
||
public function getStaticAssetSettings() : ?StaticAssetSettings { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.