Added logging option for the server command

This commit is contained in:
Alexis Métaireau 2023-10-18 12:31:54 +02:00
parent bf24f87fd7
commit 0ea9ad4c6e

View file

@ -43,11 +43,14 @@ def agent(server, auth, max_tasks, wait_time, log_level):
@click.option("--host", default="127.0.0.1", help="Host to bind") @click.option("--host", default="127.0.0.1", help="Host to bind")
@click.option("--port", default=8000, type=int, help="Port to bind") @click.option("--port", default=8000, type=int, help="Port to bind")
@click.option("--reload", is_flag=True, help="Enable hot reloading") @click.option("--reload", is_flag=True, help="Enable hot reloading")
def server(host, port, reload): @click.option("--log-config", help="Path to the logging configuration file")
def server(host, port, reload, log_config):
"""Starts the server.""" """Starts the server."""
command = ["uvicorn", "argos.server:app", "--host", host, "--port", str(port)] command = ["uvicorn", "argos.server:app", "--host", host, "--port", str(port)]
if reload: if reload:
command.append("--reload") command.append("--reload")
if log_config:
command.extend(["--log-config", log_config])
subprocess.run(command) subprocess.run(command)