remove some logs

This commit is contained in:
Saeed Vaziry
2023-08-06 23:04:01 +02:00
parent 94f14dc7a7
commit c2d515f9e5
5 changed files with 94 additions and 121 deletions

View File

@ -76,10 +76,6 @@ public function connect(bool $sftp = false): void
if (! $login) {
throw new SSHAuthenticationError("Error authenticating");
}
Log::info("Login status", [
'status' => $login
]);
} catch (Throwable $e) {
Log::error("Error connecting", [
"msg" => $e->getMessage()
@ -122,15 +118,10 @@ public function upload(string $local, string $remote): void
{
$this->log = null;
Log::info("Starting to upload");
if (! $this->connection) {
$this->connect(true);
}
Log::info("Uploading");
$uploaded = $this->connection->put($remote, $local, SFTP::SOURCE_LOCAL_FILE);
Log::info("Upload finished", [
'status' => $uploaded
]);
$this->connection->put($remote, $local, SFTP::SOURCE_LOCAL_FILE);
}
/**
@ -139,28 +130,17 @@ public function upload(string $local, string $remote): void
protected function executeCommand(string|SSHCommand $command): string
{
if ($command instanceof SSHCommand) {
$commandContent = $command->content($this->server->os);
$commandContent = $command->content();
} else {
$commandContent = $command;
}
Log::info("command", [
"asUser" => $this->asUser,
"content" => $commandContent
]);
if ($this->asUser) {
$commandContent = 'sudo su - '.$this->asUser.' -c '.'"'.addslashes($commandContent).'"';
}
Log::info("Running command", [
"cmd" => $commandContent
]);
$output = $this->connection->exec($commandContent);
Log::info("Command executed");
$this->log?->write($output);
if (Str::contains($output, 'VITO_SSH_ERROR')) {