Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] create a log! macro #187

Closed
maciejka opened this issue Sep 12, 2024 · 14 comments
Closed

[feat] create a log! macro #187

maciejka opened this issue Sep 12, 2024 · 14 comments
Assignees
Labels

Comments

@maciejka
Copy link
Collaborator

maciejka commented Sep 12, 2024

Create a log! macro to improve debuggability. It should use scarb's procedural macro to create a log! macro call:

log!(DEBUG, "validating tx: {}", txid);

where arguments are:

  • logging level(one of TRACE, DEBUG),
  • log message format,
  • values to be included in the log message.

log! should use println! under the hood to output messages.

Logging level should be controlled by scarb features, i.e.: it should be possible to set current log level by setting log related feature: log_level_trace, log_level_debug. No logging should be the default.

Reading:

This issue requires Rust knowledge.

@maciejka maciejka added the blocked Requires other issues to be resolved first label Sep 12, 2024
@ShantelPeters
Copy link

Hi @maciejka can I please work on this?

Copy link

onlydustapp bot commented Sep 12, 2024

Hey @ShantelPeters!
Thanks for showing interest.
We've created an application for you to contribute to Raito - Bitcoin ZK Client.
Go check it out on OnlyDust!

@mubarak23
Copy link
Contributor

mubarak23 commented Sep 12, 2024

@maciejka can i take this

PR for issue: #178 is ready here

so am available to start working on this right away

Copy link

onlydustapp bot commented Sep 12, 2024

Hey @mubarak23!
Thanks for showing interest.
We've created an application for you to contribute to Raito - Bitcoin ZK Client.
Go check it out on OnlyDust!

@maciejka
Copy link
Collaborator Author

@maciejka can i take this

PR for issue: #178 is ready here

so am available to start working on this right away

Do you have any Rust experience?

@maciejka
Copy link
Collaborator Author

Hi @maciejka can I please work on this?

Do you have any Rust experience?

@mubarak23
Copy link
Contributor

mubarak23 commented Sep 12, 2024

@maciejka can i take this
PR for issue: #178 is ready here
so am available to start working on this right away

Do you have any Rust experience?

Yes, checkout my Github profile here

work on the following rust codebase

@maciejka maciejka removed the blocked Requires other issues to be resolved first label Sep 13, 2024
@TropicalDog17
Copy link

Hi @maciejka, can I work on this issue? I have fairly amount of experience in Rust. Thanks!

https://github.com/paradigmxyz/reth/commits/main/?author=TropicalDog17
near/near-sdk-rs#1220

Copy link

onlydustapp bot commented Sep 13, 2024

Hey @TropicalDog17!
Thanks for showing interest.
We've created an application for you to contribute to Raito - Bitcoin ZK Client.
Go check it out on OnlyDust!

@TropicalDog17
Copy link

Hi, I've follow the scarb guild for writing procedural macros, but I can't manage to import in in Cairo code. here is the logging package
image

the file content is exactly the same as the example: https://docs.swmansion.com/scarb/docs/reference/procedural-macro.html#procedural-macro-packages-can-be-used-as-dependencies

image
and I've imported to the client package, but the compiler doesn't seem to recognize the new logging package, and scarb build also fails to complete.

image

@maciejka @m-kus any idea about this, will appreciate any help. Thank you!

@maciejka
Copy link
Collaborator Author

@TropicalDog17 create a draft pr please, we will have a look then.
You might have a look at alexandria macros.

@TropicalDog17
Copy link

I've figured out @maciejka, but how to achieve

Logging level should be controlled by scarb [features](https://docs.swmansion.com/scarb/docs/reference/conditional-compilation.html#features), i.e.: it should be possible to set current log level by setting log related feature: log_level_trace, log_level_debug. No logging should be the default.

How to achieve the conditional compilation in Cairo, in rust I think we can get the feature value of config with cfg!() macro, but I can't figure how to do it in Cairo

@maciejka
Copy link
Collaborator Author

https://docs.swmansion.com/scarb/docs/reference/conditional-compilation.html#features

Let's continue this discussion in the pr.

@maciejka
Copy link
Collaborator Author

Closing as features support in Scarb is not mature enough yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants