Package com.yahoo.log

Class VespaFormat

java.lang.Object
com.yahoo.log.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 Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    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.
    static String
    format(String levelName, String component, String componentPrefix, long millis, String threadId, String serviceName, String formattedMessage, Throwable t)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static void
    Deprecated, for removal: This API element is subject to removal in a future version.
    static void
    formatTime(long time, StringBuilder sbuffer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static String
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VespaFormat

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

    • 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

      @Deprecated(since="7", forRemoval=true) public static void formatTime(long time, StringBuilder sbuffer)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • formatTime

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

      @Deprecated(since="7", forRemoval=true) public static String format(String levelName, String component, String componentPrefix, long millis, String threadId, String serviceName, String formattedMessage, Throwable t)
      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