mirror of
https://github.com/status-im/status-python-sdk.git
synced 2026-08-31 06:01:19 +00:00
- Rename repository from `bot` to `status_sdk` - Add `pyproject.toml` file - Update code documentation - Move `docker-compose.yaml` in folder `status_sdk` - Update `Account` docker volume paths - Update Agent example - Add `volume_folder` to `Account`
25 lines
643 B
Python
25 lines
643 B
Python
from typing import Optional
|
|
import logging
|
|
|
|
class Logger:
|
|
instance: Optional[logging.Logger] = None
|
|
|
|
def __new__(cls) -> logging.Logger:
|
|
|
|
if cls.instance:
|
|
return cls.instance
|
|
|
|
cls.instance = logging.getLogger("status-bot")
|
|
cls.instance.setLevel(logging.INFO)
|
|
cls.instance.propagate = False
|
|
|
|
handler = logging.StreamHandler()
|
|
formatter = logging.Formatter(
|
|
f"[%(asctime)s] [%(levelname)s]\t%(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S"
|
|
)
|
|
|
|
handler.setFormatter(formatter)
|
|
cls.instance.addHandler(handler)
|
|
return cls.instance
|