-
Notifications
You must be signed in to change notification settings - Fork 86
2.0 idea collection
There is Message::setLevel($level)
which accepts both numeric log-levels (syslog-style) and string error-levels (PSR-3 style). Message::getLevel()
returns the PSR-variant, Message::getSyslogLevel()
.
The logic to convert the $level
argument is in the static methods Message::logLevelToPsr
and Message::logLevelToSyslog
Implement a new class Gelf\LogLevel
with getPsr()
and getSyslog()
. Private constructor, and static fromPsr(string $level)
and fromSyslog(int $level)
"factory-methods".
BC break: Message::getLevel()
will then always return LogLevel
and Message::setLevel(LogLevel $level)
only accept an instance of this.
We can introduce the ValueObject already in 1.0 an move all logic the class. But we have to keep the current behaviour of the concerned Message
methods. Those can be declared @deprecated
in the next minor release.
TransportInterface
and PublisherInterface
look pretty much the same, both take a message and push it somewhere. UdpTransport even implements both interfaces.
Transports also assume they get also passed valid messages and are not expected to do any message integrity validation.
ValidMessage
: Defines a MessageInterface object as validated.
- Add a new class which decorates a MessageInterface. No setter just
___construct(MessageInterface $message)
andgetMessage()
PublisherInterface
: Responsible for validating a message and distributing it via a DistributionStrategy.
- BC Break: Add getters and setters for both MessageValidator and DistributionStrategy to the PublisherInterface
- BC Break: Remove all methods form Publisher regarding transports
- Wraps a MessageInterface in ValidMessage after validation, and pushes it to the DistributionStrategy
DistributionStrategyInterface
: Responsible for the timing and distribution of a ValidMessage to one or multiple endpoints
- Create the interface with
addTransport(TransportInterface $transport)
,getTransports()
,removeTransport(TransportInterface $transport)
,distribute(ValidMessage $message)
- Add a NullDistributionStrategy which throws away any transport and message it is given
- Add a SimpleDistributionStrategy which just loops over every transport and delivers the message
- More ideas: Buffered, Deferred (unlimited buffer), Filtered,...
TransportInterface
: Responsible for the transport of a ValidMessage to a GELF endpoint via TCP/IP, HTTP, AMQP, etc.
-
BC Break: Change
transport(MessageInterface $message)
totransport(ValidMessage)
With this in mind, a transport should never implement the PublisherInterface. BC Break: Remove PublisherInterface from all transports implementing it.
Messages do their array-transformation in toArray()
. Since GELF 1.1 this does not make any sense anymore because different the versions require a different serialization.
There is also already the code-infrastructure for MessageEncoders
.
- BC Break: Rename Encoders to Transformers
- Introduce a ArrayTransformer which does the correct array transformation in regards to a message's version
- BC break: Remove MessageInterface::toArray