Kirby should provide an ‘official’ root for logs.
Many plugins log stuff and it would be nice to have a dedicated directory for that, even if Kirby itself doesn’t write any data there. When used inside a plugin, a Logger class/utility (maybe like @bvdputte‘s kirbylog?) could write to a folder named after the plugin.
Some plugins place their logs inside site anyway - so if I configured it to be somewhere else, all plugins using this core feature would follow this decision rather than writing to a hardcoded destination.
While we’re at it: exposing an after hook we could let people hook into it and implement their own solutions , like sending it to a mail address, saving to database etc - for Kirby being file-based first, writing files to a dedicated directory should suffice!
See this forum thread
Trying to read the room here: would site/logs/
be the one preferred commonly? @S1SYPHOS @Bart Vandeputte
@Nico , for my plugin I choose not to pick site/logs
since it looked so “generic” and could clash with other devs already using that location. Now it seems some devs would really like to have it there, so I’ll just make it an option in my plugin.
The default will continue to be in site/kirbylogs
to avoid breaking existing installations.
As stated in the forum thread about this, I’ld only see value in a logger being added to core if core itself has options to log things. IIRC core now uses the default php error log in case of errors and when debug: false
in config. No other things can be logged.
Nonetheless, core provides hooks, so with my little logger plugin you could use these to have logs of the things you want/need.
PS; there are other log plugins as well. Eg bnomei has a more advanced one. One of the advantages of having this as a plugin is that ppl can choose what kind of logger they want.
I do get that the logs location should be configurable.
@Nico Answering your question: yes, I am all for site/logs.
While having a core logging feature is another but closely related topic, I am also in favour of this, but you are right, it is a separate concern.
Thanks to all for your support of this idea!
@Nico I noticed you tagged it “Completed”. Where can we “see” this?
@Bart Vandeputte in an upcoming release. We’ll rename the label to make it clearer
That was fast. Thanks everyone!