Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andylokandy committed Jun 16, 2024
1 parent dc82dd8 commit a39856f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:?}, ..")]
Expand Down
25 changes: 10 additions & 15 deletions tests/ui/ok/async-in-trait.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#![cfg_attr(all(feature = "nightly", test), feature(async_fn_in_trait))]
trait MyTrait {
async fn work(&self) -> Result<usize, usize>;
}

#[cfg(all(feature = "nightly", test))]
mod tests {
trait MyTrait {
async fn work(&self) -> Result<usize, usize>;
}

struct MyStruct;

impl MyTrait for MyStruct {
#[logcall::logcall("debug")]
#[logcall::logcall(ok = "debug", err = "error")]
async fn work(&self) -> Result<usize, usize> {
Ok(1)
}
struct MyStruct;

impl MyTrait for MyStruct {
#[logcall::logcall("debug")]
#[logcall::logcall(ok = "debug", err = "error")]
async fn work(&self) -> Result<usize, usize> {
Ok(1)
}
}

Expand Down

0 comments on commit a39856f

Please sign in to comment.