Since a flow will significantly affect the representation of a log event
over its life before being persistet by the final adapter, the new term
better reflects what it is responsible for.
It also helps to avoid the dupliction of meaning between Sink, Target,
Adapter.
Since an AbstractCollection can in principal contain any raw value, we
want to make sure that we only handle known values. Others will probably
still be catched by the fallback converter calls at the bottom of
AbstractCollection#normalize.
Since the Message class now formats the passed message on initialization
anyways, there is no need anymore to retain the formatter there.
Instead, we can just format the message string in the Logger before
creating the Message instance.
This significantly simplifies the Message class and better encapsulates
the knowledge about the line formatter into the Logger class.
Since we can not guarantee that a user-supplied formatter is side-effect
free, a delayed formatting might result in unexpected results. An
example of such a formatter is the one used by
ActiveSupport::TaggedLogging.
This helps in ensuring thread-safety when flushing unbuffered Buffers.
Previously, it was possibly for client code to still hold references to
fields on a flushed and cleared buffer, potentially resulting in
unintended side-effects if the client code was not aware that the buffer
was cleared.
By creating ompletely new object instances, existing references only
point to data from before the clear. This ensures a clean cut.
This is functionally equivalent. However, the previous behavior resulted
in the block being materialized as a proc which is quite expensive, both
during materialization as well as when calling it. By using
`block_given?`, we can avoid this materialization.
These methods are useful convenience methods to add (nested) fields to a
hash while optionally retaining existing values. Usually, `#deep_merge!`
or `#set` will be the commonly used ways to set fields to a hash.
This follows the rule that two objects which are eql? also have the same
hash value. It is also required to ensure that we can use collections in
sets, hashes and arrays where the hash-equality is checked for certain
operations.
This allows to define default values for certain fields which can be
inserted just before a Buffer is flushed. They won;t overwrite prior
user-provided fields.
Through the use of a block, expensive calculations for a field could be
avoided if the field is not going to be inserted, e.g. because it exists
already or is forbidden from being set.