-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from MEHRSHAD-MIRSHEKARY/refactor/defaults-and…
…-utils ⚡🔨✨ feat: add dataclass in default_settings
- Loading branch information
Showing
10 changed files
with
128 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
from .format_options import FORMAT_OPTIONS | ||
from .default_settings import ( | ||
DEFAULT_AUTO_INITIALIZATION_ENABLE, | ||
DEFAULT_INITIALIZATION_MESSAGE_ENABLE, | ||
DEFAULT_LOG_FILE_FORMATS, | ||
DEFAULT_LOG_CONSOLE_COLORIZE, | ||
DEFAULT_LOG_CONSOLE_FORMAT, | ||
DEFAULT_LOG_CONSOLE_LEVEL, | ||
DEFAULT_LOG_DATE_FORMAT, | ||
DEFAULT_LOG_DIR, | ||
DEFAULT_LOG_EMAIL_NOTIFIER, | ||
DEFAULT_LOG_FILE_LEVELS, | ||
) | ||
from .defaults import DefaultLoggingSettings | ||
from .format_specifiers import LOG_FORMAT_SPECIFIERS |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
from dataclasses import dataclass, field | ||
|
||
from django_logging.constants.settings_types import ( | ||
LogFileFormatsType, | ||
LOG_DIR_TYPE, | ||
LOG_LEVELS_TYPE, | ||
LOG_CONSOLE_FORMAT_TYPE, | ||
LOG_CONSOLE_LEVEL_TYPE, | ||
LOG_CONSOLE_COLORIZE_TYPE, | ||
LOG_DATE_FORMAT_TYPE, | ||
INITIALIZATION_MESSAGE_ENABLE_TYPE, | ||
LogEmailNotifierType, | ||
) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class DefaultLoggingSettings: | ||
log_dir: LOG_DIR_TYPE = field( | ||
default_factory=lambda: os.path.join(os.getcwd(), "logs") | ||
) | ||
log_levels: LOG_LEVELS_TYPE = field( | ||
default_factory=lambda: ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] | ||
) | ||
log_date_format: LOG_DATE_FORMAT_TYPE = "%Y-%m-%d %H:%M:%S" | ||
auto_initialization_enable: INITIALIZATION_MESSAGE_ENABLE_TYPE = True | ||
initialization_message_enable: INITIALIZATION_MESSAGE_ENABLE_TYPE = True | ||
log_file_formats: LogFileFormatsType = field( | ||
default_factory=lambda: { | ||
"DEBUG": 1, | ||
"INFO": 1, | ||
"WARNING": 1, | ||
"ERROR": 1, | ||
"CRITICAL": 1, | ||
} | ||
) | ||
log_console_level: LOG_CONSOLE_LEVEL_TYPE = "DEBUG" | ||
log_console_format: LOG_CONSOLE_FORMAT_TYPE = 1 | ||
log_console_colorize: LOG_CONSOLE_COLORIZE_TYPE = True | ||
log_email_notifier: LogEmailNotifierType = field( | ||
default_factory=lambda: { | ||
"ENABLE": False, | ||
"NOTIFY_ERROR": False, | ||
"NOTIFY_CRITICAL": False, | ||
"LOG_FORMAT": 1, | ||
"USE_TEMPLATE": True, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.