gebeer Posted October 28, 2022 Share Posted October 28, 2022 Hello all, I'm working on a concept for a module that sends error reports via email to different recipients based on different error levels (notice, warning, error) and I don't know yet how to best tackle this. It would be preferable if I could use PW internal classes, functions. I had a read through https://processwire.com/blog/posts/debugging-tools-built-in/ and especially the logging section. But looking at related classes like FileLog and WireException, it doen't seem like one can hook into them. I'm quite tempted to use NetteTracy, like TracyDebugger does. It seems like it can do what I want https://tracy.nette.org/en/guide#toc-production-mode-and-error-logging. PW is writing errors/exceptions to the log, I just wouldn't know how to tap into this, especially for different log levels. If anyone can point me in the right direction it would be much appreciated. 1 Link to comment Share on other sites More sharing options...
flydev Posted October 29, 2022 Share Posted October 29, 2022 @gebeer Interesting. You want to hook WireLog::___save() and recover the type log on arguments(0) 👉 https://github.com/processwire/processwire/blob/dev/wire/core/WireLog.php#L96-L175 1 Link to comment Share on other sites More sharing options...
gebeer Posted October 29, 2022 Author Share Posted October 29, 2022 5 minutes ago, flydev said: @gebeer Interesting. You want to hook WireLog::___save() and recover the type log on arguments(0) 👉 https://github.com/processwire/processwire/blob/dev/wire/core/WireLog.php#L96-L175 Good find, thank you. By default PW only logs errors, exceptions, not warnings or notices. So the available types would be "error" and "exceptions". Is there a way of telling PW to also log warnings and notices? Link to comment Share on other sites More sharing options...
flydev Posted October 29, 2022 Share Posted October 29, 2022 What about setting the flag as Notice::log || Notice::logOnly ? Also check @ryan comment : Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now