Skip to content

Conversation

@kemingy
Copy link
Member

@kemingy kemingy commented Sep 14, 2025

We are not using any trace features provided by tracing.

logforth has better integration with rust log crate.


Some problems:

  1. time format
  • logforth 0.27.0
- 2025-09-13T16:10:14.809393533Z
+ 2025-09-14T13:39:23.133400+00:00[UTC]
- 2025-10-30T05:40:48.707160613Z
+ 2025-10-30T05:34:24.854545+00:00
  1. JSON key-value
  • logforth 0.27
- {"timestamp":"2025-09-13T16:09:41.881703819Z","level":"INFO","fields":{"message":"socket accepted connection from","addr":"(unnamed)"},"target":"mosec::protocol"}
+ {"timestamp":"2025-09-14T13:39:23.133394+00:00[UTC]","level":"INFO","target":"mosec::protocol","file":"src/protocol.rs","line":61,"message":"socket accepted connection from","kvs":{"addr":"(unnamed)"}}
  • logforth 0.28.1
- {"timestamp":"2025-10-30T05:40:48.707160613Z","level":"INFO","fields":{"message":"http service is running","addr":"0.0.0.0:8000"},"target":"mosec"}
+ {"timestamp":"2025-10-30T05:34:24.854545+00:00","level":"INFO","target":"mosec","file":"src/main.rs","line":110,"message":"http service is running","kvs":{"addr":"0.0.0.0:8000"}}

Possible ways to fix:

(1) change the Python log format to align with logforth (which will break the previous format, might be harmful if some users already use some parsers)
(2) impl our JsonLayout (troublesome, upstream may change frequently)

  1. cannot get rid of tracing since hyper is using it
> cargo tree -i tracing
tracing v0.1.41
└── h2 v0.4.10
    └── hyper v1.6.0
        ├── axum v0.8.4
        │   ├── mosec v0.9.5 (/home/keming/GitHub/mosec)
        │   └── utoipa-swagger-ui v9.0.2
        │       └── mosec v0.9.5 (/home/keming/GitHub/mosec)
        └── hyper-util v0.1.14
            └── axum v0.8.4 (*)

Ref:

Signed-off-by: Keming <kemingy94@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant