add logs command
All checks were successful
Publish Docker Image / docker (push) Successful in 1m30s

This commit is contained in:
Lee 2024-04-17 02:36:38 +01:00
parent 9ca94d0e05
commit 2c0d4cdcae
3 changed files with 16 additions and 0 deletions

@ -2,6 +2,7 @@ from command.impl.addCommand import AddCommand
from command.impl.listCommand import ListCommand from command.impl.listCommand import ListCommand
from command.impl.removeCommand import RemoveCommand from command.impl.removeCommand import RemoveCommand
from command.impl.restartCommand import RestartCommand from command.impl.restartCommand import RestartCommand
from command.impl.logsCommand import LogsCommand
class CommandManager: class CommandManager:
@ -12,6 +13,7 @@ class CommandManager:
self.addCommand(RemoveCommand()) self.addCommand(RemoveCommand())
self.addCommand(ListCommand()) self.addCommand(ListCommand())
self.addCommand(RestartCommand()) self.addCommand(RestartCommand())
self.addCommand(LogsCommand())
pass pass
def addCommand(self, command): def addCommand(self, command):

@ -0,0 +1,10 @@
from command.command import Command
from traefik.traefikConfig import TraefikConfig
from utils.dockerUtils import getTraefikLogs
class LogsCommand(Command):
def __init__(self):
super().__init__("logs", "Get traefik logs", "logs")
def execute(self, traefikConfig: TraefikConfig, args):
getTraefikLogs()

@ -16,3 +16,7 @@ def restartTraefik():
subprocess.run(["docker", "restart", containerName]) subprocess.run(["docker", "restart", containerName])
print("Done!") print("Done!")
def getTraefikLogs():
print("Getting Traefik logs, please wait...")
subprocess.run(["docker", "logs", containerName, "-f"])