Log thread ID and name in debug mode
This commit is contained in:
parent
24aa046f8c
commit
c1fc9aa46f
1 changed files with 8 additions and 0 deletions
|
|
@ -84,9 +84,15 @@ impl axum::response::IntoResponse for AppError {
|
|||
#[cfg(debug_assertions)]
|
||||
const TRACING_LEVEL: tracing::Level = tracing::Level::DEBUG;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
const TRACING_DISPLAY_THREAD: bool = true;
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
const TRACING_LEVEL: tracing::Level = tracing::Level::INFO;
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
const TRACING_DISPLAY_THREAD: bool = false;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct Context {
|
||||
user: Option<model::User>,
|
||||
|
|
@ -99,6 +105,8 @@ struct Context {
|
|||
async fn main() {
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(TRACING_LEVEL)
|
||||
.with_thread_ids(TRACING_DISPLAY_THREAD)
|
||||
.with_thread_names(TRACING_DISPLAY_THREAD)
|
||||
.init();
|
||||
|
||||
if !process_args().await {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue