Package com.yahoo.log

Class VespaFormat


  • @Deprecated(since="7",
                forRemoval=true)
    public class VespaFormat
    extends Object
    Deprecated, for removal: This API element is subject to removal in a future version.
    Should only be used internally in the log library
    Vespa log formatting utility methods. Contains some code based on LogUtils.java in Cloudname https://github.com/Cloudname/cloudname written by Bjørn Borud, licensed under the Apache 2.0 license.
    Author:
    arnej27959, bjorncs
    • Constructor Detail

      • VespaFormat

        public VespaFormat()
        Deprecated, for removal: This API element is subject to removal in a future version.
    • Method Detail

      • escape

        public static String escape​(String s)
        Deprecated, for removal: This API element is subject to removal in a future version.
        This static method is used to detect if a message needs to be escaped, and if so, performs the escaping. Since the common case is most likely that escaping is not needed, the code is optimized for this case. The forbidden characters are:
        • newline
        • tab
        • backslash

        Also handles the case where the message is null and replaces the null message with a tag saying that the value was "(empty)".

        Parameters:
        s - String that might need escaping
        Returns:
        returns the escaped string
      • formatTime

        public static String formatTime​(Instant instant)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • formatException

        @Deprecated(since="7",
                    forRemoval=true)
        public static void formatException​(Throwable t,
                                           StringBuilder sbuf)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Format throwable into given StringBuffer.
        Parameters:
        t - The Throwable we want to format
        sbuf - The stringbuffer into which we wish to format the Throwable