This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
/vendor/
|
||||
/output/
|
||||
/temp/
|
||||
*.log
|
||||
config.yml
|
||||
composer.phar
|
@ -1,8 +1,7 @@
|
||||
notification:
|
||||
domain: ntfy.jcktrue.dk
|
||||
topic: backup
|
||||
logging:
|
||||
stream: output.log
|
||||
log: output.log
|
||||
rclone:
|
||||
bwlimit: 6M
|
||||
backup:
|
||||
|
@ -6,7 +6,7 @@ use Symfony\Component\Yaml\Exception\ParseException;
|
||||
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
class App {
|
||||
protected Logger $logger;
|
||||
@ -15,11 +15,13 @@ class App {
|
||||
function __construct(string $configFile)
|
||||
{
|
||||
$this->config = Yaml::parseFile($configFile);
|
||||
|
||||
$logger = new Logger('app');
|
||||
$logger->pushHandler(new StreamHandler($this->getConfig()['logging']['stream']));
|
||||
if(isset($this->config['log'])) {
|
||||
$logger->pushHandler(new StreamHandler($this->getConfig()['log']));
|
||||
}
|
||||
$logger->info("Initialization complete");
|
||||
|
||||
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,6 @@ class CommandBackup extends Command
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->title('Start backup process');
|
||||
|
||||
$io->info('Opening: '.$input->getArgument('config'));
|
||||
|
||||
try {
|
||||
$app = new App($input->getArgument('config'));
|
||||
}
|
||||
|
Reference in New Issue
Block a user