Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Support] : Provided Support to Log the Current Thread name attribute as mentioned in the documentations at https://actix.rs/docs/middleware/ #3330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Atri10
Copy link

@Atri10 Atri10 commented Apr 11, 2024

PR Type: [Supoort]

This PR provides support to log the name of current thread which is handling the request.

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

Current behaviour with default Format shown below

r#"%a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T"#

We get Log:

[2024-04-11T17:29:13.432712900Z INFO  actix_web::middleware::logger] 127.0.0.1 "GET /spells HTTP/1.1" 200 285229 "-" "PostmanRuntime/7.37.3" 0.020495

New Behaviour (With custom Format shown below)

wrap(Logger::new(r#"[%P] [%a] ["%r"] [Response = %s] [Size = %b] "%{Referer}i" "%{User-Agent}i" Processed in %Tms."#))

We get Log:

[2024-04-11T17:31:15.122169300Z INFO  actix_web::middleware::logger] [actix-rt|system:0|arbiter:0] [127.0.0.1] ["GET /spells HTTP/1.1"] [Response = 200] [Size = 285229] "-" "PostmanRuntime/7.37.3" Processed in 0.020377ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant