bnomei / kirby3-janitor

Kirby Plugin for running commands like cleaning the cache from within the Panel, PHP code, CLI or a cronjob
https://forum.getkirby.com/t/kirby3-janitor-plugin/23573
MIT License
89 stars 8 forks source link

how to log #45

Closed jklue closed 2 years ago

jklue commented 3 years ago

Sorry I can't figure out how to write to the logs.

bnomei commented 3 years ago

when one uses the janitor helper it will call an callback https://github.com/bnomei/kirby3-janitor/blob/dff1ed317bd393109706de5e5b8471c6e1072a9e/index.php#L168 https://github.com/bnomei/kirby3-janitor/blob/dff1ed317bd393109706de5e5b8471c6e1072a9e/classes/Janitor.php#L178

which has built in support for my monolog plugin or https://github.com/bvdputte/kirby-log https://github.com/bnomei/kirby3-janitor/blob/dff1ed317bd393109706de5e5b8471c6e1072a9e/index.php#L45

but you still have to enable it via a config setting bnomei.janitor.log.enabled => true https://github.com/bnomei/kirby3-janitor/blob/dff1ed317bd393109706de5e5b8471c6e1072a9e/index.php#L44

if you use a custom class and do stuff there its easier to just call monolog or klog youself.

bnomei commented 3 years ago

this is how i use it...

1) enable logging in settings 2) call janitor()->log(...with param...) in you "jobs" code