html2image icon indicating copy to clipboard operation
html2image copied to clipboard

There should be a way to disable the headless browsers' output

Open vgalin opened this issue 2 years ago • 2 comments

Following #54. A way to toggle browsers' output on or off could be useful, especially if the information displayed is not related to errors or bugs that can be fixed.

Example of this output using Chromium/Chrome (taken from issue #28):

[0615/164730.282582:ERROR:file_io.cc(91)] ReadExactly: expected 8, observed 0
[0615/164730.283193:ERROR:xattr.cc(63)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/8_/qh0jnghd1xd_99znh3z6tvgc0000gn/T/: Operation not permitted (1)
[0615/164730.329920:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[0615/164730.396624:WARNING:address_sorter_posix.cc(388)] FromSockAddr failed on netmask

In some cases, the browser just spams the stdout/stderr with errors or warnings that cannot be resolved. However, in other cases, when screenshots fail to be taken, these messages could hold valuable hints and allow the users to solve the issue : for this reason, these messages may not be silenced by default.

vgalin avatar Jan 27 '22 13:01 vgalin

Hi, thanks for this project!

Are there any news for this issue? I need to have a quiet output as I'm creating a CLI tool that uses this project.

Any guidance on how to implement something to solve this issue myself?

Thank you!

MadeInPierre avatar Jun 02 '23 20:06 MadeInPierre

Any guidance on how to implement something to solve this issue myself?

It's implemented already under the name disable_logging! (Undocumented, but working). The following works:

hti = Html2Image(disable_logging=True)

peterwilli avatar Dec 08 '23 19:12 peterwilli