refactor: improve logging system and add deployment fixes
- Enhance logging handlers (Console, DockerJson, File, JsonFile, MultiFile) - Improve exception and line formatters - Update logger initialization and processor management - Add Ansible playbooks for staging 502 error troubleshooting - Update deployment documentation - Fix serializer and queue components - Update error kernel and queued log handler
This commit is contained in:
@@ -23,7 +23,7 @@ use RuntimeException;
|
||||
*/
|
||||
|
||||
// Enhanced handler that supports formatters
|
||||
class FormattableHandler implements LogHandler
|
||||
class LogHandler implements LogHandler
|
||||
{
|
||||
public array $handledOutputs = [];
|
||||
|
||||
@@ -68,10 +68,10 @@ it('demonstrates different formatters with same log data', function () {
|
||||
])->addTags('error', 'order_processing');
|
||||
|
||||
// Create handlers with different formatters
|
||||
$lineHandler = new FormattableHandler(new LineFormatter());
|
||||
$jsonHandler = new FormattableHandler(new JsonFormatter());
|
||||
$devHandler = new FormattableHandler(new DevelopmentFormatter(colorOutput: false));
|
||||
$structuredHandler = new FormattableHandler(new StructuredFormatter());
|
||||
$lineHandler = new LogHandler(new LineFormatter());
|
||||
$jsonHandler = new LogHandler(new JsonFormatter());
|
||||
$devHandler = new LogHandler(new DevelopmentFormatter(colorOutput: false));
|
||||
$structuredHandler = new LogHandler(new StructuredFormatter());
|
||||
|
||||
$logger = new DefaultLogger(
|
||||
handlers: [$lineHandler, $jsonHandler, $devHandler, $structuredHandler],
|
||||
@@ -124,9 +124,9 @@ it('demonstrates formatter customization options', function () {
|
||||
$kvFormatter = new StructuredFormatter(format: 'kv');
|
||||
|
||||
$handlers = [
|
||||
'custom_line' => new FormattableHandler($customLineFormatter),
|
||||
'pretty_json' => new FormattableHandler($prettyJsonFormatter),
|
||||
'key_value' => new FormattableHandler($kvFormatter),
|
||||
'custom_line' => new LogHandler($customLineFormatter),
|
||||
'pretty_json' => new LogHandler($prettyJsonFormatter),
|
||||
'key_value' => new LogHandler($kvFormatter),
|
||||
];
|
||||
|
||||
$logger = new DefaultLogger(handlers: array_values($handlers));
|
||||
@@ -149,7 +149,7 @@ it('demonstrates formatter customization options', function () {
|
||||
|
||||
it('demonstrates formatter performance with batch logging', function () {
|
||||
$jsonFormatter = new JsonFormatter();
|
||||
$handler = new FormattableHandler($jsonFormatter);
|
||||
$handler = new LogHandler($jsonFormatter);
|
||||
$logger = new DefaultLogger(handlers: [$handler]);
|
||||
|
||||
// Batch log multiple entries
|
||||
|
||||
Reference in New Issue
Block a user