Logger-Service hinzugefügt und Docker-Compose-Option wait implementiert
This commit is contained in:
39
src/Service/Docker/Logger/LoggerService.php
Normal file
39
src/Service/Docker/Logger/LoggerService.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*
|
||||
* LoggerService.php 2026-03-27 thomas
|
||||
*
|
||||
* Copyright (c) 2026 Thomas Schneider <thomas@inter-mundos.de>
|
||||
* Alle Rechte vorbehalten.
|
||||
*/
|
||||
|
||||
namespace App\Service\Docker\Logger;
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class LoggerService
|
||||
{
|
||||
const string LOG_FILE = 'docker.log';
|
||||
|
||||
|
||||
public function __construct(
|
||||
protected string $logDir,
|
||||
){}
|
||||
|
||||
|
||||
public function log(string $message): void
|
||||
{
|
||||
new Filesystem()->appendToFile($this->logDir . DIRECTORY_SEPARATOR . self::LOG_FILE, $message . PHP_EOL);
|
||||
}
|
||||
|
||||
|
||||
public function clearLog(): void
|
||||
{
|
||||
new Filesystem()->remove($this->logDir . DIRECTORY_SEPARATOR . self::LOG_FILE);
|
||||
}
|
||||
|
||||
|
||||
public function getLog(): string
|
||||
{
|
||||
return new Filesystem()->readFile($this->logDir . DIRECTORY_SEPARATOR . self::LOG_FILE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user