1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-05-19 16:58:14 +00:00

Compare commits

...

6 commits

Author SHA1 Message Date
fawn 7a14853b62
Merge 7d659229f6 into ba7fd048b6 2024-04-16 20:07:02 -04:00
dependabot[bot] ba7fd048b6
build(deps): bump codecov/codecov-action from 4.2.0 to 4.3.0 (#3331)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4.2.0...v4.3.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 01:02:44 +00:00
dependabot[bot] d98938b125
build(deps): bump taiki-e/install-action from 2.32.9 to 2.32.17 (#3332)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.32.9 to 2.32.17.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.32.9...v2.32.17)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 01:02:30 +00:00
dependabot[bot] 5a5486b484
build(deps): bump taiki-e/install-action from 2.32.0 to 2.32.9 (#3325)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.32.0 to 2.32.9.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.32.0...v2.32.9)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 07:19:03 +00:00
dependabot[bot] 76b2b2734b
build(deps): bump codecov/codecov-action from 4.1.1 to 4.2.0 (#3326)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.1 to 4.2.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4.1.1...v4.2.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 07:17:45 +00:00
fawn 7d659229f6
feat: change log level based on response status code 2023-08-20 16:46:45 +03:00
5 changed files with 18 additions and 9 deletions

View file

@ -45,7 +45,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack and cargo-ci-cache-clean - name: Install cargo-hack and cargo-ci-cache-clean
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: cargo-hack,cargo-ci-cache-clean
@ -88,7 +88,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- name: Install cargo-hack - name: Install cargo-hack
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: cargo-hack tool: cargo-hack
@ -109,7 +109,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- name: Install nextest - name: Install nextest
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: nextest tool: nextest

View file

@ -50,7 +50,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack and cargo-ci-cache-clean - name: Install cargo-hack and cargo-ci-cache-clean
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: cargo-hack,cargo-ci-cache-clean

View file

@ -23,7 +23,7 @@ jobs:
components: llvm-tools-preview components: llvm-tools-preview
- name: Install cargo-llvm-cov - name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: cargo-llvm-cov tool: cargo-llvm-cov
@ -31,7 +31,7 @@ jobs:
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.1.1 uses: codecov/codecov-action@v4.3.0
with: with:
files: codecov.json files: codecov.json
fail_ci_if_error: true fail_ci_if_error: true

View file

@ -82,7 +82,7 @@ jobs:
toolchain: nightly-2023-08-25 toolchain: nightly-2023-08-25
- name: Install cargo-public-api - name: Install cargo-public-api
uses: taiki-e/install-action@v2.32.0 uses: taiki-e/install-action@v2.32.17
with: with:
tool: cargo-public-api tool: cargo-public-api

View file

@ -16,7 +16,7 @@ use actix_service::{Service, Transform};
use actix_utils::future::{ready, Ready}; use actix_utils::future::{ready, Ready};
use bytes::Bytes; use bytes::Bytes;
use futures_core::ready; use futures_core::ready;
use log::{debug, warn}; use log::{debug, warn, Level};
use pin_project_lite::pin_project; use pin_project_lite::pin_project;
#[cfg(feature = "unicode")] #[cfg(feature = "unicode")]
use regex::Regex; use regex::Regex;
@ -367,6 +367,12 @@ where
debug!("Error in response: {:?}", error); debug!("Error in response: {:?}", error);
} }
let level = match res.response().status().as_u16() {
300..=499 => Level::Warn,
500..=599 => Level::Error,
_ => Level::Info,
};
let res = if let Some(ref mut format) = this.format { let res = if let Some(ref mut format) = this.format {
// to avoid polluting all the Logger types with the body parameter we swap the body // to avoid polluting all the Logger types with the body parameter we swap the body
// out temporarily since it's not usable in custom response functions anyway // out temporarily since it's not usable in custom response functions anyway
@ -397,6 +403,7 @@ where
format, format,
size: 0, size: 0,
log_target, log_target,
level,
}))) })))
} }
} }
@ -409,6 +416,7 @@ pin_project! {
size: usize, size: usize,
time: OffsetDateTime, time: OffsetDateTime,
log_target: Cow<'static, str>, log_target: Cow<'static, str>,
level: Level,
} }
impl<B> PinnedDrop for StreamLog<B> { impl<B> PinnedDrop for StreamLog<B> {
@ -421,8 +429,9 @@ pin_project! {
Ok(()) Ok(())
}; };
log::info!( log::log!(
target: this.log_target.as_ref(), target: this.log_target.as_ref(),
this.level,
"{}", FormatDisplay(&render) "{}", FormatDisplay(&render)
); );
} }