extensive changes
This commit is contained in:
18
src/pymd3_vue_location_sim/json_formatter.py
Normal file
18
src/pymd3_vue_location_sim/json_formatter.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import logging
|
||||
import json
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
root_logger = logging.getLogger()
|
||||
logger = logging.getLogger("ios-api")
|
||||
|
||||
class JsonFormatter(logging.Formatter):
|
||||
def format(self, record: logging.LogRecord) -> str:
|
||||
payload = {
|
||||
"ts": self.formatTime(record, "%Y-%m-%dT%H:%M:%S%z"),
|
||||
"level": record.levelname,
|
||||
"logger": record.name,
|
||||
"message": record.getMessage(),
|
||||
}
|
||||
if record.exc_info:
|
||||
payload["exc_info"] = self.formatException(record.exc_info)
|
||||
return json.dumps(payload, ensure_ascii=True)
|
||||
Reference in New Issue
Block a user