MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / ShanghaiTimeFormatter

Class ShanghaiTimeFormatter

src/core/utils.py:26–35  ·  view source on GitHub ↗

强制日志 asctime 输出为上海时间,避免容器/服务器时区差异。

Source from the content-addressed store, hash-verified

24
25
26class ShanghaiTimeFormatter(logging.Formatter):
27 """
28 强制日志 asctime 输出为上海时间,避免容器/服务器时区差异。
29 """
30
31 def formatTime(self, record, datefmt=None): # noqa: N802
32 dt = datetime.fromtimestamp(record.created, tz=timezone.utc).astimezone(SHANGHAI_TZ)
33 if datefmt:
34 return dt.strftime(datefmt)
35 return dt.strftime("%Y-%m-%d %H:%M:%S")
36
37
38def setup_logging(

Callers 1

setup_loggingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected