workaround #1

This commit is contained in:
2021-11-20 16:33:16 +00:00
parent df2318aaaf
commit e98f1ad80d
3 changed files with 28 additions and 21 deletions

17
.vscode/settings.json vendored
View File

@@ -4,20 +4,5 @@
"python.linting.enabled": true,
"python.pythonPath": ".venv/bin/python",
"restructuredtext.confPath": "${workspaceFolder}/docs/source",
"peacock.color": "#307E6A",
"workbench.colorCustomizations": {
"editorGroup.border": "#3ea389",
"panel.border": "#3ea389",
"sash.hoverBorder": "#3ea389",
"sideBar.border": "#3ea389",
"statusBar.background": "#307e6a",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#3ea389",
"statusBarItem.remoteBackground": "#307e6a",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#307e6a",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#307e6a99",
"titleBar.inactiveForeground": "#e7e7e799"
}
"peacock.color": "#307E6A"
}

View File

@@ -32,16 +32,21 @@ See Tembo for an example: <https://github.com/tembo-pages/tembo-core/blob/main/t
Example snippet to use in a module:
```python
"""Subpackage that contains the CLI application."""
import os
from typing import Any
import panaetius
from panaetius.exceptions import LoggingDirectoryDoesNotExistException
if (config_path := os.environ.get("TEMBO_CONFIG")) is not None:
CONFIG = panaetius.Config("tembo", config_path, skip_header_init=True)
CONFIG: Any = panaetius.Config("tembo", config_path, skip_header_init=True) # type: ignore
else:
CONFIG = panaetius.Config("tembo", "~/tembo/.config", skip_header_init=True)
CONFIG: Any = panaetius.Config( # type: ignore
"tembo", "~/tembo/.config", skip_header_init=True
)
panaetius.set_config(CONFIG, "base_path", "~/tembo")

View File

@@ -106,6 +106,11 @@ class LoggingData(metaclass=ABCMeta):
def format(self) -> str:
raise NotImplementedError
@property
@abstractmethod
def logging_level(self) -> str:
raise NotImplementedError
@abstractmethod
def __init__(self, logging_level: str):
raise NotImplementedError
@@ -119,8 +124,12 @@ class SimpleLogger(LoggingData):
'"%(levelname)s",\n\t"message": "%(message)s"\n}',
)
@property
def logging_level(self) -> str:
return self._logging_level
def __init__(self, logging_level: str = "INFO"):
self.logging_level = logging_level
self._logging_level = logging_level
class AdvancedLogger(LoggingData):
@@ -133,8 +142,12 @@ class AdvancedLogger(LoggingData):
'"%(levelname)s",\n\t"message": "%(message)s"\n}',
)
@property
def logging_level(self) -> str:
return self._logging_level
def __init__(self, logging_level: str = "INFO"):
self.logging_level = logging_level
self._logging_level = logging_level
class CustomLogger(LoggingData):
@@ -142,6 +155,10 @@ class CustomLogger(LoggingData):
def format(self) -> str:
return str(self._format)
@property
def logging_level(self) -> str:
return self._logging_level
def __init__(self, logging_format: str, logging_level: str = "INFO"):
self.logging_level = logging_level
self._logging_level = logging_level
self._format = logging_format