From a39856f0dffc8ef2193c5b5bc946a580292eaaca Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Sun, 16 Jun 2024 20:52:25 +0800 Subject: [PATCH] fix --- .github/workflows/ci.yml | 8 ++++---- README.md | 10 +++++----- tests/ui/ok/async-in-trait.rs | 25 ++++++++++--------------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 825cdbb..30c59e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install Rust nightly - run: rustup toolchain install nightly - - name: Use Rust nightly - run: rustup default nightly + - name: Install Rust stable + run: rustup toolchain install stable + - name: Use Rust stable + run: rustup default stable - name: Build run: cargo build --verbose - name: Run tests diff --git a/README.md b/README.md index 05a18e8..3440d43 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ fn main() { When the `main` function runs, it initializes the logger and logs each function call as specified: -``` +```ignore [2024-06-16T12:41:04Z DEBUG main] add(a = 2, b = 3) => 5 [2024-06-16T12:41:04Z INFO main] multiply(a = 2, b = 3) => 6 [2024-06-16T12:41:04Z ERROR main] divide(a = 2, b = 0) => Err("Division by zero") @@ -86,19 +86,19 @@ When the `main` function runs, it initializes the logger and logs each function ## Customization - **Default Log Level**: If no log level is specified, `logcall` logs at the `debug` level: - ```rust + ```rust,ignore #[logcall] ``` - **Specify Log Level**: Use the macro parameters to specify log level: - ```rust + ```rust,ignore #[logcall("info")] - **Specify Log Levels for `Result`**: Use the `ok` and `err` parameters to specify log levels for `Ok` and `Err` variants: - ```rust + ```rust,ignore #[logcall(err = "error")] #[logcall(ok = "info", err = "error")] ``` - **Customize Input Logging**: Use the `input` parameter to customize the input log format: - ```rust + ```rust,ignore #[logcall(input = "a = {a:?}, ..")] #[logcall("info", input = "a = {a:?}, ..")] #[logcall(ok = "info", err = "error", input = "a = {a:?}, ..")] diff --git a/tests/ui/ok/async-in-trait.rs b/tests/ui/ok/async-in-trait.rs index 7714f89..7071846 100644 --- a/tests/ui/ok/async-in-trait.rs +++ b/tests/ui/ok/async-in-trait.rs @@ -1,19 +1,14 @@ -#![cfg_attr(all(feature = "nightly", test), feature(async_fn_in_trait))] +trait MyTrait { + async fn work(&self) -> Result; +} -#[cfg(all(feature = "nightly", test))] -mod tests { - trait MyTrait { - async fn work(&self) -> Result; - } - - struct MyStruct; - - impl MyTrait for MyStruct { - #[logcall::logcall("debug")] - #[logcall::logcall(ok = "debug", err = "error")] - async fn work(&self) -> Result { - Ok(1) - } +struct MyStruct; + +impl MyTrait for MyStruct { + #[logcall::logcall("debug")] + #[logcall::logcall(ok = "debug", err = "error")] + async fn work(&self) -> Result { + Ok(1) } }