seravo-plugin icon indicating copy to clipboard operation
seravo-plugin copied to clipboard

Add Seravo Plugin logger

Open JoosuaKoskinen opened this issue 3 years ago • 1 comments

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?

JoosuaKoskinen avatar Aug 10 '21 13:08 JoosuaKoskinen

@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.

Moppa5 avatar Aug 10 '21 13:08 Moppa5