Skip to content

Commit

Permalink
Renames
Browse files Browse the repository at this point in the history
  • Loading branch information
YolanFery committed Dec 3, 2024
1 parent 24abe8f commit 9e11310
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
35 changes: 35 additions & 0 deletions openhexa/sdk/pipelines/log_level.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Log levels for the pipeline runs."""
from enum import IntEnum


class LogLevel(IntEnum):
"""
Enum representing different log levels.
- Attributes:
DEBUG (int): Debug level, value 0.
INFO (int): Info level, value 1.
WARNING (int): Warning level, value 2.
ERROR (int): Error level, value 3.
CRITICAL (int): Critical level, value 4.
"""

DEBUG = 0
INFO = 1
WARNING = 2
ERROR = 3
CRITICAL = 4

@classmethod
def parse_log_level(cls, value) -> "LogLevel":
"""Parse a log level from a string or integer."""
if isinstance(value, int) and 0 <= value <= 4:
return LogLevel(value)
if isinstance(value, str):
if value.isdigit():
return cls.parse_log_level(int(value))
value = value.upper()
if hasattr(cls, value):
return getattr(cls, value)
return cls.INFO
22 changes: 0 additions & 22 deletions openhexa/sdk/pipelines/priority.py

This file was deleted.

0 comments on commit 9e11310

Please sign in to comment.