Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
febo authored Nov 10, 2024
1 parent aa83760 commit ecf5d12
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sdk/log/macro/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# `pinocchio-log-macro`
# <img height="70" alt="pinocchio-log-macro" src="https://github.com/user-attachments/assets/ea3a100d-c89b-4f54-93ae-b3c2ffbd4610"/>

Companion `log!` macro for `pinocchio-log`. It automates the creation of a `Logger` object to log a message. It support a limited subset of the [`format!`](https://doc.rust-lang.org/std/fmt/) syntax. The macro parses the format string at compile time and generates the calls to a `Logger` object to generate the corresponding formatted message.
Companion `log!` macro for [`pinocchio-log`](https://crates.io/crates/pinocchio-log). It automates the creation of a `Logger` object to log a message. It support a limited subset of the [`format!`](https://doc.rust-lang.org/std/fmt/) syntax. The macro parses the format string at compile time and generates the calls to a `Logger` object to generate the corresponding formatted message.

## Usage

The macro works very similar to `solana-program` [`msg!`](https://docs.rs/solana-program/latest/solana_program/macro.msg.html) macro.

To output a simple message (static `str`):
To output a simple message (static `&str`):
```rust
use pinocchio_log::log

Expand All @@ -21,7 +21,7 @@ let amount = 1_000_000_000;
log!("transfer amount: {}", amount);
```

Since a `Logger` size is statically determined, messages are limited to `200` length by default. When logging larger messages, it is possible to increase the logger buffer:
Since a `Logger` size is statically determined, messages are limited to `200` length by default. When logging larger messages, it is possible to increase the logger buffer size:
```rust
use pinocchio_log::log

Expand All @@ -31,4 +31,4 @@ log!(500, "message: {}", very_long_message);

## License

The code is licensed under the [Apache License Version 2.0](LICENSE)
The code is licensed under the [Apache License Version 2.0](LICENSE)

0 comments on commit ecf5d12

Please sign in to comment.