WooCommerce 2.7 introduced a new class for handling logging. The handler itself can be replaced, which is awesome.
The default handler creates log files on the server and stores the entries in plain text. The trouble I have with that:
- it's kind of hard to get access to the file, as most of the time you need read access to the FTP server, because if the file itself is too big, the WordPress dashboard isn't going to show any portion of it
- even if it CAN show it because PHP is configured to open large files, downloading and displaying a large text file in a textarea is going to cause a lot of data to be downloaded, and depending on how the browser handles memory, it might become slow
- because it's just plain text, there's no way so search / sort / reorder / filter the entries at all
- if you need to correlate multiple log files (potentially written by multiple plugins / themes), then you'll need to manually match up entries in multiple files - not exactly the best use of your debugging time
- if your server runs out of disk space due to logging, that will cause a cascade failure and your entire site is brought down
- even if it doesn't, because you have a lot of space, just PHP opening huge files, writing at the end of it, and then closing the file will take significant server resources after a while. Especially if it needs to do that a number of times in succession
So here's my thinking. I will build a cloud based logging system, that will display incoming logs in real time as they get in from your server. I will build a plugin to send the logs to this service in real time. This will be a nice project for me to learn about the following things:
- Laravel, because that's what's going to handle receiving and storing and displaying the information
- vue.js because I wanted to, so that's going to be the front end of the project
- golang, maybe, if I need to rewrite the Laravel backend
I'm pretty sure there are a bunch of cloud based loggers already doing this. https://papertrailapp.com/ is one I know of.
It's mainly a vehicle for me to learn. And if people find it useful, and would love to pay for it, then all the better!