Skip to content

Commit

Permalink
default log levels: DEBUG for dev, INFO for stable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sebix committed Aug 27, 2024
1 parent c16a8d2 commit 59d511c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions docs/dev/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ These apply to all projects:

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

Eventually adapt the default log levels if necessary. Should be INFO for stable releases.

### IntelMQ API

- `intelmq_api/version.py`: Update the version.
Expand Down
9 changes: 7 additions & 2 deletions intelmq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2014 Tomás Lima
# SPDX-FileCopyrightText: 2014 Tomás Lima, 2015-2020 nic.at GmbH, 2024 Institute for Common Good Technology
#
# SPDX-License-Identifier: AGPL-3.0-or-later

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


DEFAULT_LOGGING_LEVEL = "INFO"
if isinstance(__version_info__[-1], str) and __version_info__[-1][0].lower() in ('a', 'b', 'd'):
# for alpha, beta and dev instances, set default log level to DEBUG, for others, including RCs, use INFO
DEFAULT_LOGGING_LEVEL = "DEBUG"
else:
DEFAULT_LOGGING_LEVEL = "INFO"

HARMONIZATION_CONF_FILE = os.path.join(CONFIG_DIR, "harmonization.conf")
RUNTIME_CONF_FILE = os.path.join(CONFIG_DIR, "runtime.yaml")
old_runtime_conf_file = pathlib.Path(RUNTIME_CONF_FILE).with_suffix('.conf')
Expand Down

0 comments on commit 59d511c

Please sign in to comment.