From 022b6fa4f8a3d8d71df4c07467d615aaa1215d13 Mon Sep 17 00:00:00 2001 From: widal001 Date: Fri, 6 Dec 2024 16:31:28 -0500 Subject: [PATCH 1/2] feat: Initializes logs for db-migrate entry point --- analytics/src/analytics/cli.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/analytics/src/analytics/cli.py b/analytics/src/analytics/cli.py index 5b41f98e5..961c2602d 100644 --- a/analytics/src/analytics/cli.py +++ b/analytics/src/analytics/cli.py @@ -75,6 +75,11 @@ def callback() -> None: init() +# Initialize the logger for db-migrate which is exposed directly +# by the db-migrate entrypoint +init() + + # =========================================================== # Export commands # =========================================================== From 9a2b7730a74a45ed476bc0a016170ef0a59c3489 Mon Sep 17 00:00:00 2001 From: widal001 Date: Fri, 6 Dec 2024 16:43:23 -0500 Subject: [PATCH 2/2] fix: Only initializes the logger once to avoid duplicate logs --- analytics/src/analytics/cli.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/analytics/src/analytics/cli.py b/analytics/src/analytics/cli.py index 961c2602d..26281b4ea 100644 --- a/analytics/src/analytics/cli.py +++ b/analytics/src/analytics/cli.py @@ -61,23 +61,14 @@ app.add_typer(etl_app, name="etl", help="Transform and load local file") -def init() -> None: - """Shared init function for all scripts.""" - # Setup logging - init_logging(__package__) - init_app(logging.root) +# Setup logging +init_logging(__package__) +init_app(logging.root) @app.callback() def callback() -> None: """Analyze data about the Simpler.Grants.gov project.""" - # If you override this callback, remember to call init() - init() - - -# Initialize the logger for db-migrate which is exposed directly -# by the db-migrate entrypoint -init() # ===========================================================