mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-26 13:26:04 +08:00
Add os and browser parameters to opera log (#97)
This commit is contained in:
@ -102,6 +102,8 @@ class OperaLogMiddleware:
|
|||||||
path=path,
|
path=path,
|
||||||
ipaddr=ip,
|
ipaddr=ip,
|
||||||
location=location,
|
location=location,
|
||||||
|
os=os,
|
||||||
|
browser=browser,
|
||||||
args=args,
|
args=args,
|
||||||
status=status,
|
status=status,
|
||||||
code=code,
|
code=code,
|
||||||
|
@ -21,6 +21,8 @@ class OperaLog(DataClassBase):
|
|||||||
path: Mapped[str] = mapped_column(String(500), comment='请求路径')
|
path: Mapped[str] = mapped_column(String(500), comment='请求路径')
|
||||||
ipaddr: Mapped[str] = mapped_column(String(50), comment='IP地址')
|
ipaddr: Mapped[str] = mapped_column(String(50), comment='IP地址')
|
||||||
location: Mapped[str] = mapped_column(String(50), comment='归属地')
|
location: Mapped[str] = mapped_column(String(50), comment='归属地')
|
||||||
|
os: Mapped[str] = mapped_column(String(50), comment='操作系统')
|
||||||
|
browser: Mapped[str] = mapped_column(String(50), comment='浏览器')
|
||||||
args: Mapped[str | None] = mapped_column(JSON(), comment='请求参数')
|
args: Mapped[str | None] = mapped_column(JSON(), comment='请求参数')
|
||||||
status: Mapped[bool] = mapped_column(comment='操作状态(0异常 1正常)')
|
status: Mapped[bool] = mapped_column(comment='操作状态(0异常 1正常)')
|
||||||
code: Mapped[int] = mapped_column(insert_default=200, comment='操作状态码')
|
code: Mapped[int] = mapped_column(insert_default=200, comment='操作状态码')
|
||||||
|
@ -12,6 +12,8 @@ class OperaLogBase(BaseModel):
|
|||||||
path: str
|
path: str
|
||||||
ipaddr: str
|
ipaddr: str
|
||||||
location: str
|
location: str
|
||||||
|
os: str
|
||||||
|
browser: str
|
||||||
args: str | None
|
args: str | None
|
||||||
status: bool
|
status: bool
|
||||||
code: int
|
code: int
|
||||||
|
Reference in New Issue
Block a user