Seravo / seravo-plugin

Enhances WordPress with Seravo specific features and integrations
https://seravo.com/
GNU General Public License v2.0
37 stars 17 forks source link

Add Seravo Plugin logger #609

Open JoosuaKoskinen opened 2 years ago

JoosuaKoskinen commented 2 years ago

Is your feature request related to a problem? Please describe.

We currently have a lot of error_log in the code and the message always looks different. The message often doesn't tell anything about what function it was printed from: [09-Aug-2021 10:56:55 UTC] SWD API () error 401:

Describe the solution you'd like

We could have a simple Logger::error_log($message) which would prefix the messages with [Seravo Plugin] or something. Also if SERAVO_PLUGIN_DEBUG mode is enabled, it could automatically add a stack trace.

Often before version releases, I loop trough sites and grep php-error.logs to see if the previous version had some issues we havent fixed. Some unified string in the log messages (like [Seravo Plugin] prefix) would make finding Seravo Plugin errors much easier.

What do you think @Moppa5?

Moppa5 commented 2 years ago

@JoosuaKoskinen, Absolutely! This would do a great job with the unifying style as well. In general, I think all this kind of repetition should be trivial, like on this instance logging an api error.