Skip to content

Commit 59d511c

Browse files
committed
default log levels: DEBUG for dev, INFO for stable
set the default log level (internal fallback value) to - DEBUG if the version number indicates this is a preliminary release (alpha, beta, dev) - INFO if the version number indicates a stable release (last part is integer, release candidate or anything else removes the need to check and adappt this manually at every release or starts of development cycles
1 parent c16a8d2 commit 59d511c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

docs/dev/release.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ These apply to all projects:
3030

3131
- `intelmq/version.py`: Update the version.
3232

33-
Eventually adapt the default log levels if necessary. Should be INFO for stable releases.
34-
3533
### IntelMQ API
3634

3735
- `intelmq_api/version.py`: Update the version.

intelmq/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2014 Tomás Lima
1+
# SPDX-FileCopyrightText: 2014 Tomás Lima, 2015-2020 nic.at GmbH, 2024 Institute for Common Good Technology
22
#
33
# SPDX-License-Identifier: AGPL-3.0-or-later
44

@@ -29,7 +29,12 @@
2929
VAR_STATE_PATH = os.path.join(ROOT_DIR, "var/lib/bots/")
3030

3131

32-
DEFAULT_LOGGING_LEVEL = "INFO"
32+
if isinstance(__version_info__[-1], str) and __version_info__[-1][0].lower() in ('a', 'b', 'd'):
33+
# for alpha, beta and dev instances, set default log level to DEBUG, for others, including RCs, use INFO
34+
DEFAULT_LOGGING_LEVEL = "DEBUG"
35+
else:
36+
DEFAULT_LOGGING_LEVEL = "INFO"
37+
3338
HARMONIZATION_CONF_FILE = os.path.join(CONFIG_DIR, "harmonization.conf")
3439
RUNTIME_CONF_FILE = os.path.join(CONFIG_DIR, "runtime.yaml")
3540
old_runtime_conf_file = pathlib.Path(RUNTIME_CONF_FILE).with_suffix('.conf')

0 commit comments

Comments
 (0)