Closed dnaber-de closed 3 years ago
This is not really feasible if only for BC reasons, although we could technically implement ArrayAccess but that'd make everything slower for no great benefit.
The concept of record is kind of the only thing to understand about monolog internals so I don't think it's too much to ask :) But I get what you are saying though and I do think it could be documented better for sure.
Well, I didn't had backward compatibility in mind when I thought about that. Of course that is more important.
While I was writing a processor recently, I stumbled over the array passed to the processors
__invoke
method. I was not sure about the arrays structure, so I quickly dumped it usingvar_dump()
. It would be nice to have an object here with an interface to work against.Another benefit of an record object would be, that processors needn't to take care about each other when more of them add extra data for example.
Here's a simple example of an record interface:
It might be discussable whether both
setLevel()
andsetLevelName()
are necessary as this might lead to an inconsistency of the object. However It's just an idea for an improvement.