Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Support rust logging #262

Closed
austinabell opened this issue Apr 6, 2021 · 3 comments · Fixed by #263
Closed

Support rust logging #262

austinabell opened this issue Apr 6, 2021 · 3 comments · Fixed by #263

Comments

@austinabell
Copy link
Contributor

austinabell commented Apr 6, 2021

Is your feature request related to a problem? Please describe.
Rust logging through the https://docs.rs/log/0.4.14/log/ interface allows the user to have control over how the logs are output, instead of forcing printing to std out. This can be useful if someone wants to ignore logs from any/all modules, log asynchronously, have variable log levels, or even change where the logs are output.

Describe the solution you'd like

println! usages switched to log equivalents.

@gakonst
Copy link
Owner

gakonst commented Apr 7, 2021

We already do this with tracing! Each request made to the node is logged this way: https://github.com/gakonst/ethers-rs/blob/master/ethers-providers/src/provider.rs#L117-L127

@austinabell
Copy link
Contributor Author

We already do this with tracing! Each request made to the node is logged this way: https://github.com/gakonst/ethers-rs/blob/master/ethers-providers/src/provider.rs#L117-L127

Ah okay my bad I didn't see, the files I looked in when checking were using println iirc. I'll have another look to see, maybe I'll make a pass through to swap those?

@gakonst
Copy link
Owner

gakonst commented Apr 7, 2021

That sounds good to me! Thank you.

meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this issue Mar 21, 2022
* fix(cast): call deserialization

After this commit, the return value of `cast call`
will be still be printed even if the ABI type of the
return value is not specified. This matches the
behavior of `seth`.

Example:

```
$ cast call 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 'WETH()(address)'
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

$ cast call 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 'WETH()'
0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
```

Previously, the second command above would print nothing as there
would be no decoded values to iterate over when building the
string output.

This commit also prepends a `0x` to each decoded return type,
which matches the behavior of `seth`.

* Update cast/src/lib.rs

Co-authored-by: Matthias Seitz <[email protected]>

Co-authored-by: Georgios Konstantopoulos <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants