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

View File

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

View File

@ -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()

View File

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