XF 2.3 Addon Logging Solution

QuackieMackie

Active member
The more addons I work on, the more I find myself needing logging, and creating it for each addon was just not something I wanted to do / maintain. So I made my own solution until it eventually hopefully gets added into the core functionality, a library that will contain all those bits I find myself needing at some point across multiple projects.

Currently this addon has only been used on my dev enviroment, but it won't be long before I'll be moving it to my site.

If anyone wants to take a look, wants to use it, they are welcome to it. As most of my projects are, you can find it on my sites github repo here:
View attachment CentralLogExample.Mp4
 
Or you could use Monolog which is pretty much an industry standard with the ability to link into a huge number of external systems for log tracking.
I could’ve, yep. :) Maybe in the future I’ll use a third-party library, but for my projects it felt like overkill.

Plus, the last time I worked with a third-party library in XenForo, I ended up rewriting a bunch of it to make it work, so I’m a little hesitant to go down that road again.
 
This is extremely helpful!! I was considering a similar solution myself, especially with the recent bot issues flooding our error logs

Have you considered adding admin permissions to access this page? Either per-addon, or just in general?

I am definitely going to use this in my addon, appreciate you sharing this to the community!
 
This is extremely helpful!! I was considering a similar solution myself, especially with the recent bot issues flooding our error logs

Have you considered adding admin permissions to access this page? Either per-addon, or just in general?

I am definitely going to use this in my addon, appreciate you sharing this to the community!
Adding dynamic permissions seems a little tricky. I don't think i'd be able to do this inside the library.
I think it would require the addon making logs to create a permission, but that would be possible and i'll look into adding it.

Adding permissions and bits will come soon :) I've just about finished with the looks of everything, just a few bits left I want to add such as log retention, log clearing, and exporting.
 
As pointed out by @Sim there already is an Add-on for logging, so I am not sure if reinventing the wheel is a great idea here.

At very least, please implement this to be PSR-3 compatible, especially as XenForo already ships the interfaces anyway.

If you do this, you might also want to cooperate with @Xon to get the foundation (at least logging stubs) supported via Standard Library, this way there would be at least a chance to somewhat wider adoption :)

You shoud also probably rename a bunch of phrases for compliance with resource standards rule # 25.
 
Last edited:
At very least, please implement this to be PSR-3 compatible, especially as XenForo already ships the interfaces anyway.
Thank you I haven't heard of this, I'll aim for that next.
I'm still learning the ropes for PHP and i've only worked with it is while using Xenforo so being told bits like this is helpful.

so I am not sure if reinventing the wheel is a great idea here.
Your correct, it's not needed for me to reinvent the wheel and that is by no means my intention.
I just wanted to give it a go myself rather than relying on someone elses addon. As I said i'm new to php and creating addons like what I did here helps me understand it a bit better.

I might have to take some time to read through php concepts as I seem to be missing a few fundamentals.

You shoud also probably rename a bunch of phrases for compliance with resource standards rule # 25.
I need to go over and change those still.. I am terrible for remembering this.

I'll have to look into what stubs are as well, i've never heard of this.

You've been very helpful :)
 
Last edited:
Back
Top Bottom