Extract Logging too

Leave only the core essentials in App
This commit is contained in:
dhh
2023-09-16 10:03:28 -07:00
parent d303fcc621
commit 6b5c5f0650
2 changed files with 21 additions and 21 deletions

View File

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