mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

How to add logging to a preprocessor?

Open d3vr4ndOm opened this issue 2 years ago • 1 comments

Question

I currently try to write my own little preprocessor and want to add some logging to follow a long what is happening inside the preprocessor itself.

Right now I have the feeling that mdbook build crashes when adding any log output. This might be due to the fact that mdbook is listening for the processed book on stdin and therefor is interpreting my log messages written to stdin as ready processed book and fails.

So my question would be how to properly implement logging for a preprocessor?

I currently worked around it by writing to stderr, but I guess this is not the right way how it should be.

Thanks for the help

Version

mdbook v0.4.34

d3vr4ndOm avatar Aug 26 '23 13:08 d3vr4ndOm

An environment variable RUST_LOG=debug seems to emit output that covers preprocessors as well (in part, at least).

sanmai-NL avatar Sep 16 '25 07:09 sanmai-NL