go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.25k stars 345 forks source link

How to Log CDP Logs to a File or Use slog #1066

Closed thuongtin closed 3 months ago

thuongtin commented 3 months ago

I’m currently working on a project using the go-rod/rod library and I need some assistance with logging CDP logs. Specifically, I want to achieve one of the following:

1.  Log CDP logs to a file.
2.  Use slog for logging CDP logs.

Could anyone provide guidance or examples on how to implement either of these logging methods with go-rod/rod? Any help or pointers to relevant documentation would be greatly appreciated.

github-actions[bot] commented 3 months ago

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.116.0

generated by check-issue

ysmood commented 3 months ago

All the unit test of rod will output files, check the unit test code as example:

https://github.com/go-rod/rod/blob/0340433eab4e6551f075eaf1875035469a777480/setup_test.go#L253-L259