Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into feat/database-service-logs-endpoint

Yanluis Ferminea941da631d9
diff --cc bootstrap/helpers/docker.php
index 771937ce09,739f98f220..cad49f4596
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@@ -1115,19 -1089,19 +1115,19 @@@ function validateComposeFile(string $co
}
}
-function getContainerLogs(Server $server, string $container_id, int $lines = 100): string
+function getContainerLogs(Server $server, string $container_id, int $lines = 100, bool $showTimestamps = false): string
{
+ $command = "docker logs -n {$lines} {$container_id}";
if ($server->isSwarm()) {
- $output = instant_remote_process([
- "docker service logs -n {$lines} {$container_id}",
- ], $server);
- } else {
- $output = instant_remote_process([
- "docker logs -n {$lines} {$container_id}",
- ], $server);
+ $command = "docker service logs -n {$lines} {$container_id}";
+ }
+
+ if ($showTimestamps) {
+ $command .= ' --timestamps';
}
+ $output = instant_remote_process([$command], $server);
- $output .= removeAnsiColors($output);
+ $output = removeAnsiColors($output);
return $output;
}