mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-07 05:50:41 +02:00
updates utils.logging
This commit is contained in:
parent
0136885207
commit
d5cd97ea57
@ -47,7 +47,7 @@ class SocketIOHandler(logging.Handler):
|
|||||||
super().__init__(logging.ERROR)
|
super().__init__(logging.ERROR)
|
||||||
self._sio = sio
|
self._sio = sio
|
||||||
|
|
||||||
def format(self, record: logging.LogRecord) -> str:
|
def format(self, record: logging.LogRecord) -> str: # noqa: A003
|
||||||
return f"{record.name}:{record.funcName}:{record.lineno} - {record.message}"
|
return f"{record.name}:{record.funcName}:{record.lineno} - {record.message}"
|
||||||
|
|
||||||
def emit(self, record: logging.LogRecord) -> None:
|
def emit(self, record: logging.LogRecord) -> None:
|
||||||
@ -123,7 +123,10 @@ def setup_logging(level: Optional[str | int] = None) -> None:
|
|||||||
# add formatter to ch
|
# add formatter to ch
|
||||||
ch.setFormatter(
|
ch.setFormatter(
|
||||||
DefaultFormatter(
|
DefaultFormatter(
|
||||||
fmt="%(asctime)s.%(msecs)03d | %(levelprefix)s | %(name)s:%(funcName)s:%(lineno)d - %(message)s",
|
fmt=(
|
||||||
|
"%(asctime)s.%(msecs)03d | %(levelprefix)s | "
|
||||||
|
"%(name)s:%(funcName)s:%(lineno)d - %(message)s"
|
||||||
|
),
|
||||||
datefmt="%Y-%m-%d %H:%M:%S",
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -140,7 +143,8 @@ def setup_logging(level: Optional[str | int] = None) -> None:
|
|||||||
"fmt"
|
"fmt"
|
||||||
] = "%(asctime)s.%(msecs)03d | %(levelprefix)s %(message)s"
|
] = "%(asctime)s.%(msecs)03d | %(levelprefix)s %(message)s"
|
||||||
LOGGING_CONFIG["formatters"]["default"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
|
LOGGING_CONFIG["formatters"]["default"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
|
||||||
LOGGING_CONFIG["formatters"]["access"][
|
LOGGING_CONFIG["formatters"]["access"]["fmt"] = (
|
||||||
"fmt"
|
"%(asctime)s.%(msecs)03d | %(levelprefix)s %(client_addr)s "
|
||||||
] = '%(asctime)s.%(msecs)03d | %(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s'
|
'- "%(request_line)s" %(status_code)s'
|
||||||
|
)
|
||||||
LOGGING_CONFIG["formatters"]["access"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
|
LOGGING_CONFIG["formatters"]["access"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user