Skip to content

Commit

Permalink
Pass logger to log_version_info
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Nov 6, 2023
1 parent e89e7d8 commit a4ff545
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/openeo_aggregator/about.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
import sys
from typing import Optional

__version__ = "0.12.2a1"


def log_version_info():
log = logging.getLogger(__name__)
log.info(f"openeo-aggregator {__version__} (Python {sys.version}")
def log_version_info(logger: Optional[logging.Logger] = None):
logger = logger or logging.getLogger(__name__)
logger.info(f"openeo-aggregator {__version__} (Python {sys.version})")
2 changes: 1 addition & 1 deletion src/openeo_aggregator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create_app(config: Any = None, auto_logging_setup: bool = True) -> flask.Fla
if auto_logging_setup:
setup_logging(config=get_aggregator_logging_config(context=LOGGING_CONTEXT_FLASK))

log_version_info()
log_version_info(logger=_log)

os.environ.setdefault(ConfigGetter.OPENEO_BACKEND_CONFIG, str(get_config_dir() / "backend_config.py"))

Expand Down
2 changes: 1 addition & 1 deletion src/openeo_aggregator/background/prime_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def prime_caches(
require_zookeeper_writes: bool = False,
fail_mode: str = FAIL_MODE_FAILFAST,
):
log_version_info()
log_version_info(logger=_log)
with TimingLogger(title=f"Prime caches", logger=_log):
config: AggregatorConfig = get_config(config)
_log.info(f"Using config: {config.get('config_source')=}")
Expand Down

0 comments on commit a4ff545

Please sign in to comment.