I think that we should strive for using CharSequence (rather than String or StringBuilder) whenever possible in parameter and return types for stuff which can contain more than about 64 chars.
On Tue, Mar 22, 2016 at 7:24 PM, Matt Sicker <[email protected]> wrote: > Makes sense to me. I always like using the weakest type necessary. > > On 22 March 2016 at 11:45, Remko Popma <[email protected]> wrote: > >> Mikael's message below gave me an idea: >> >> why don't we change Message.getFormattedMessage() to return a >> CharSequence instead of a String? >> >> I believe this change would be backwards compatible (all Message >> implementations that return a String will work as is), and it opens the way >> for Message implementations to return a cached StringBuilder as Mikael >> suggested. >> >> Thoughts? >> >> >> On Wed, Mar 23, 2016 at 3:04 AM, Mikael Ståldal < >> [email protected]> wrote: >> >>> I think it will be difficult to adapt all layouts (and appenders without >>> layouts) to use StringBuilderFormattable.formatTo(StringBuilder) instead >>> of String Message.getFormattedMessage(). >>> >>> I suggest we add another method to StringBuilderFormattable: >>> >>> CharSequence getFormattedMessageBuffer(); // feel free to suggest a >>> better name >>> >>> That method could just return the StringBuilder, and be equally >>> allocation free. The each layout / appender can use whichever method is >>> easiest in that case. >>> >>> I am looking at GelfLayout, and it would be easier to use a method >>> returning a CharSequence instead of formatTo(StringBuilder). >>> >>> On Tue, Mar 22, 2016 at 4:50 PM, Mikael Ståldal < >>> [email protected]> wrote: >>> >>>> Should we to the trimming in getFormattedMessage() as well as in >>>> toFormat()? >>>> >>>> On Tue, Mar 22, 2016 at 4:38 PM, Remko Popma <[email protected]> >>>> wrote: >>>> >>>>> Thanks! Done. >>>>> >>>>> Sent from my iPhone >>>>> >>>>> On 2016/03/23, at 0:10, Mikael Ståldal <[email protected]> >>>>> wrote: >>>>> >>>>> I think that RingBufferLogEvent#StringBuilderWrapperMessage need to >>>>> have a proper implementation of getFormattedMessage(), otherwise layouts >>>>> and appenders which does not use formatTo() will not work. >>>>> >>>>> -- >>>>> [image: MagineTV] >>>>> >>>>> *Mikael Ståldal* >>>>> Senior software developer >>>>> >>>>> *Magine TV* >>>>> [email protected] >>>>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >>>>> >>>>> Privileged and/or Confidential Information may be contained in this >>>>> message. If you are not the addressee indicated in this message >>>>> (or responsible for delivery of the message to such a person), you may >>>>> not copy or deliver this message to anyone. In such case, >>>>> you should destroy this message and kindly notify the sender by reply >>>>> email. >>>>> >>>>> >>>> >>>> >>>> -- >>>> [image: MagineTV] >>>> >>>> *Mikael Ståldal* >>>> Senior software developer >>>> >>>> *Magine TV* >>>> [email protected] >>>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >>>> >>>> Privileged and/or Confidential Information may be contained in this >>>> message. If you are not the addressee indicated in this message >>>> (or responsible for delivery of the message to such a person), you may >>>> not copy or deliver this message to anyone. In such case, >>>> you should destroy this message and kindly notify the sender by reply >>>> email. >>>> >>> >>> >>> >>> -- >>> [image: MagineTV] >>> >>> *Mikael Ståldal* >>> Senior software developer >>> >>> *Magine TV* >>> [email protected] >>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >>> >>> Privileged and/or Confidential Information may be contained in this >>> message. If you are not the addressee indicated in this message >>> (or responsible for delivery of the message to such a person), you may >>> not copy or deliver this message to anyone. In such case, >>> you should destroy this message and kindly notify the sender by reply >>> email. >>> >> >> > > > -- > Matt Sicker <[email protected]> > -- [image: MagineTV] *Mikael Ståldal* Senior software developer *Magine TV* [email protected] Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
