Spaces:
Runtime error
Runtime error
Commit ·
de34903
1
Parent(s): bceff47
Adds logger and it's config file
Browse files
elise/src/configs/logging_config.yaml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: 1
|
| 2 |
+
formatters:
|
| 3 |
+
simple:
|
| 4 |
+
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 5 |
+
handlers:
|
| 6 |
+
console:
|
| 7 |
+
class: logging.StreamHandler
|
| 8 |
+
formatter: simple
|
| 9 |
+
stream: ext://sys.stdout
|
| 10 |
+
Root:
|
| 11 |
+
Level: DEBUG
|
| 12 |
+
handlers: [console]
|
elise/src/utils/__init__.py
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
from .
|
|
|
|
|
|
| 1 |
+
from .gradio import df_to_json
|
| 2 |
+
from . import logger
|
elise/src/utils/{gradio_utils.py → gradio.py}
RENAMED
|
File without changes
|
elise/src/utils/logger.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging.config
|
| 2 |
+
import yaml
|
| 3 |
+
|
| 4 |
+
with open('elise/src/configs/logging_config.yaml', 'r') as f:
|
| 5 |
+
config = yaml.safe_load(f.read())
|
| 6 |
+
logging.config.dictConfig(config)
|
| 7 |
+
logging.captureWarnings(True)
|
| 8 |
+
|
| 9 |
+
def get_logger(name: str):
|
| 10 |
+
"""Logs a message
|
| 11 |
+
Args:
|
| 12 |
+
name(str): name of logger
|
| 13 |
+
"""
|
| 14 |
+
logger = logging.getLogger(name)
|
| 15 |
+
return logger
|