Allow lines option to be configured when following app logs

This commit is contained in:
Ahmed Al Hafoudh
2024-01-08 09:34:38 +01:00
parent 457f06da13
commit 0d709a3fdb
3 changed files with 15 additions and 6 deletions

View File

@@ -6,11 +6,11 @@ module Kamal::Commands::App::Logging
("grep '#{grep}'" if grep)
end
def follow_logs(host:, grep: nil)
def follow_logs(host:, lines: nil, grep: nil)
run_over_ssh \
pipe(
current_running_container_id,
"xargs docker logs --timestamps --tail 10 --follow 2>&1",
"xargs docker logs --timestamps#{" --tail #{lines}" if lines} --follow 2>&1",
(%(grep "#{grep}") if grep)
),
host: host