Skip to content

Commit

Permalink
Optional teams messages (OpenSTEF#523)
Browse files Browse the repository at this point in the history
* Set default teams messages to true

Signed-off-by: Clara De Smet <[email protected]>

* Skip teams message

Signed-off-by: Clara De Smet <[email protected]>

* Format Python code with Black

Signed-off-by: black <[email protected]>

* Added loglevel in (new) appsetting.

Signed-off-by: Bart Pleiter <[email protected]>

* Fix appsetting and isort.

Signed-off-by: Bart Pleiter <[email protected]>

* Manual format.

Signed-off-by: Bart Pleiter <[email protected]>

* Restarting build

Signed-off-by: Clara De Smet <[email protected]>

* Formatting

Signed-off-by: Clara De Smet <[email protected]>

* Removed duplicate import

Signed-off-by: Clara De Smet <[email protected]>

* Added missing type annotation

Signed-off-by: Clara De Smet <[email protected]>

* Wrong type annotation

Signed-off-by: Clara De Smet <[email protected]>

* Removed old import

---------

Signed-off-by: Clara De Smet <[email protected]>
Signed-off-by: black <[email protected]>
Signed-off-by: Bart Pleiter <[email protected]>
Co-authored-by: black <[email protected]>
Co-authored-by: Bart Pleiter <[email protected]>
  • Loading branch information
3 people authored Mar 28, 2024
1 parent e3d9052 commit bab850a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions openstef/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
class AppSettings(BaseSettings):
"""Global app settings."""

# Logging settings.
log_level: str = Field("INFO", description="Log level used for logging statements.")

model_config = SettingsConfigDict(
env_prefix="openstef_", env_file=".env", extra="ignore"
)

post_teams_messages: bool = True

# Logging settings.
log_level: str = Field("INFO", description="Log level used for logging statements.")
2 changes: 1 addition & 1 deletion openstef/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Openstef custom exceptions."""


# Define custom exception
# Define custom exceptions
class NoPredictedLoadError(Exception):
"""No predicted load for given datatime range."""

Expand Down
3 changes: 3 additions & 0 deletions openstef/monitoring/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def post_teams(
Note:
This function is namespace-specific.
"""
if not Settings.post_teams_messages:
return

structlog.configure(
wrapper_class=structlog.make_filtering_bound_logger(
logging.getLevelName(Settings.log_level)
Expand Down

0 comments on commit bab850a

Please sign in to comment.