Closed SerikDM closed 9 years ago
Why not different instances of KLogger?
Damn Kenny you were fast! Different instances of Klogger should do the trick. Implementing different log files inside Klogger would require a lot of modifications and break PSR standards on multiple function calls.
onno-vos-dev thank you for your comment. I was afraid of high memory usage.
Klogger is pretty memory friendly :) I think you'd have more memory issues at other places of your code than Klogger. I have used Klogger to generate enormous logfiles containing millions of rows with no performance issues whatsoever :)
I was following the convo, but out of pocket until now ;)
Re memory usage, I'd say the (negligible) memory usage issue is outweighed by the annoyance of a developer having to do something like:
$logger->debug('database', 'Some log line.');
// as opposed to
$dblog->debug('Some log line');
It's small, but having an extra parameter everywhere would get old quickly. Plus a wrapper class would take 10 minutes to write and serve your needs perfectly. But as @onno-vos-dev said, the bigger issue is the PSR standard.
What about having different log files? i.e. to have one file for database logs, another for payment services, another for core issues, and so on?