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

Feature: Add logging setup instructions to DEVELOPER.md #223

Open
alexzaitsev opened this issue Feb 24, 2025 · 3 comments
Open

Feature: Add logging setup instructions to DEVELOPER.md #223

alexzaitsev opened this issue Feb 24, 2025 · 3 comments
Labels
feature New feature or request

Comments

@alexzaitsev
Copy link

Describe desired feature

It would be great if DEVELOPER.md doc contained some information on how logging is set up and how to configure it.

For example, I see SimpleLogger in the main.rs. I tried to change LevelFiler to LevelFilter::Debug but this still show all debug logs across the project.

    SimpleLogger::new()
        .with_level(LevelFilter::Warn)
        .with_module_level("simln_lib", cli.log_level)
        .with_module_level("sim_cli", cli.log_level)
        .init()
        .unwrap();

Example of the logs that are not shown:

  • file: lib.rs
  • fn: produce_events
  • log: log::debug!("Generated payment: {source} -> {}: {amount} msat.", destination);
    As a workaround, I have to change log::debug! to println! but this won't work in the long run.

Use case for feature

It will help a lot for all new folks who want to contribute.

Would you like to contribute code for this feature?

@alexzaitsev alexzaitsev added the feature New feature or request label Feb 24, 2025
@alexzaitsev alexzaitsev changed the title Add logging setup instructions to DEVELOPER.md Feature: Add logging setup instructions to DEVELOPER.md Feb 27, 2025
@carlaKC
Copy link
Contributor

carlaKC commented Mar 3, 2025

Could you explain what you were looking to achieve here? IIUC you wanted to turn on debug logging only for the produce_events function in lib.rs?

I think it's pretty standard for a logging library to only allow setting log level per-module, and the SimpleLogger docs are sufficient to explain that IMO.

@alexzaitsev
Copy link
Author

I'd like just to see debug logs where they already are. I followed SimpleLogger docs but wasn't able to set up this as it's described above.

@carlaKC
Copy link
Contributor

carlaKC commented Mar 3, 2025

Oh, well by default we're setting those to info but you can run the program with -l debug to change the log level?

sim-cli --help:

  -l, --log-level <LOG_LEVEL>
          Level of verbosity of the messages displayed by the simulator.
          Possible values: [off, error, warn, info, debug, trace] [default: info]

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

No branches or pull requests

2 participants