event loop: add LogOptions struct and reduce the log size #200

pull ismaelsadeeq wants to merge 1 commits into bitcoin-core:master from ismaelsadeeq:master changing 5 files +24 −15
  1. ismaelsadeeq commented at 3:38 pm on September 2, 2025: member

    This PR fixes #190 by reducing the maximum size of characters to from 1000 to 200.

    This is achieved by creating a new struct LogOptions The LogOptions struct will contain i) The log callback function pointer ii) The maximum character to pass to LogEscape

    The main motivation is to reduce the verbosity of the logs and make
    LogEscape max_size configurable.

  2. DrahtBot commented at 3:38 pm on September 2, 2025: none

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky, Eunovo

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. ismaelsadeeq marked this as a draft on Sep 2, 2025
  4. ismaelsadeeq commented at 3:57 pm on September 2, 2025: member
    In draft while C.I is red.
  5. in example/calculator.cpp:57 in 24f106d27a outdated
    53@@ -54,7 +54,7 @@ int main(int argc, char** argv)
    54         std::cerr << argv[1] << " is not a number or is larger than an int\n";
    55         return 1;
    56     }
    57-    mp::EventLoop loop("mpcalculator", LogPrint);
    58+    mp::EventLoop loop("mpcalculator", {LogPrint});
    


    Eunovo commented at 7:23 am on September 3, 2025:

    ismaelsadeeq commented at 7:43 am on September 3, 2025:
    Fixed thanks.
  6. ismaelsadeeq force-pushed on Sep 3, 2025
  7. ismaelsadeeq marked this as ready for review on Sep 3, 2025
  8. in src/mp/proxy.cpp:190 in e6013d793e outdated
    187+EventLoop::EventLoop(const char* exe_name, LogOptions log_opts, void* context)
    188     : m_exe_name(exe_name),
    189       m_io_context(kj::setupAsyncIo()),
    190       m_task_set(new kj::TaskSet(m_error_handler)),
    191-      m_log_fn(std::move(log_fn)),
    192+      m_log_opts(log_opts),
    


    ryanofsky commented at 8:40 pm on September 3, 2025:

    In commit “event loop: make log options configurable” (e6013d793e1be2d1becdbe422c7c4ce5bc1d9e28)

    I think it might be a little better if the PR avoided changing the EventLoop signature, and just assigned m_log_opts.log_fn = log_fn in the body of the constructor. This would prevent downstream code in bitcoin core that uses the EventLoop from breaking, and make it a little easier to merge the subtree PR, not breaking the build in the subtree bump commit. Another option to stay compatible could be to have two constructors, though I like that idea a little less.


    ismaelsadeeq commented at 1:36 pm on September 5, 2025:
    Thanks for review Done.
  9. ryanofsky approved
  10. ryanofsky commented at 8:43 pm on September 3, 2025: collaborator
    Code review ACK e6013d793e1be2d1becdbe422c7c4ce5bc1d9e28. Thanks for the patch! Happy to merge as-is if you prefer, but commented below to recommend not changing the EventLoop constructor to make the PR a little smaller and make this easier to merge into bitcoin
  11. ismaelsadeeq force-pushed on Sep 5, 2025
  12. ismaelsadeeq renamed this:
    event loop: make log options configurable
    event loop: add LogOptions struct and reduce the log size
    on Sep 5, 2025
  13. ismaelsadeeq commented at 1:38 pm on September 5, 2025: member

    Forced pushed to address @ryanofsky recent comment

    ce5bc1d9e28..d9eb7fb8c

  14. in test/mp/test/test.cpp:63 in d9eb7fb8cb outdated
    59@@ -60,6 +60,7 @@ class TestSetup
    60 
    61     TestSetup(bool client_owns_connection = true)
    62         : thread{[&] {
    63+
    


    ryanofsky commented at 1:56 pm on September 5, 2025:

    In commit “eventloop: add LogOptions struct” (d9eb7fb8cbeb58d3843f3d32974831b26613bc92)

    Note: extra newline is added here, should be no need to change this file anymore


    ismaelsadeeq commented at 1:58 pm on September 5, 2025:
    Fixed
  15. ryanofsky approved
  16. ryanofsky commented at 1:56 pm on September 5, 2025: collaborator
    Code review ACK d9eb7fb8cbeb58d3843f3d32974831b26613bc92. Looks great, thanks for the update!
  17. DrahtBot requested review from Eunovo on Sep 5, 2025
  18. eventloop: add `LogOptions` struct
    - The LogOptions struct will contain
      i) The log callback function pointer
      ii) The maximum character to pass to LogEscape
    
    - This also reduce the verbosity of the logs and make
      LogEscape max_size configurable.
    85003409f9
  19. ismaelsadeeq force-pushed on Sep 5, 2025
  20. ryanofsky approved
  21. ryanofsky commented at 2:24 pm on September 5, 2025: collaborator
    Code review ACK 85003409f964d1e2eae97e6ed19b1ca39fd31df7. Just whitespace cleanup since last review. Nice to have a shrinking PR
  22. Eunovo approved
  23. ryanofsky merged this on Sep 5, 2025
  24. ryanofsky closed this on Sep 5, 2025

  25. ryanofsky referenced this in commit a334bbe9b7 on Sep 5, 2025
  26. fanquake referenced this in commit 9c6fa07b12 on Sep 8, 2025
  27. Sjors referenced this in commit 132621fc01 on Sep 23, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-04 19:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me