Idea: EventLoggerInterface
This is just an idea.
In ACPAN, our logger has an event()
method. In the context of json-logs, the idea is to have a property on the log object that is less likely to change than message
.
If (and it's a big if) we want to add something like that here, it would probably be best to add a separate interface, along with a trait that implements it.
But I'm not quite 100% sure it's so broadly useful, and even less sure that I've figured out a really general API for it. I have the occasional impulse to define some kind of LogEvent
interface, and then EventLogger::event(LogEvent $event)
could be a thing. So then you could model events with strict dependencies and do things like:
$logger->event(new Event\UserSignedUp($user));
Going down that road is possibly interesting in a system that already has a bunch of event classes with event instances flying around already or something.
After typing this out, I think it's out of scope for this library. It's a cool approach, but is probably is detail-dependent on the individual app that's doing the logging.