Package com.yahoo.log
Class VespaFormat
- java.lang.Object
-
- com.yahoo.log.VespaFormat
-
public class VespaFormat extends java.lang.Object
Vespa log formatting utility methods. Contains some code based on Util.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 VespaFormat()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
escape(java.lang.String s)
This static method is used to detect if a message needs to be escaped, and if so, performs the escaping.static java.lang.String
format(java.lang.String levelName, java.lang.String component, java.lang.String componentPrefix, long millis, java.lang.String threadId, java.lang.String serviceName, java.lang.String formattedMessage, java.lang.Throwable t)
Deprecated, for removal: This API element is subject to removal in a future version.static void
formatException(java.lang.Throwable t, java.lang.StringBuilder sbuf)
Deprecated, for removal: This API element is subject to removal in a future version.static void
formatTime(long time, java.lang.StringBuilder sbuffer)
Deprecated, for removal: This API element is subject to removal in a future version.UseformatTime(Instant)
()}static java.lang.String
formatTime(java.time.Instant instant)
-
-
-
Method Detail
-
escape
public static java.lang.String escape(java.lang.String s)
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, java.lang.StringBuilder sbuffer)
Deprecated, for removal: This API element is subject to removal in a future version.UseformatTime(Instant)
()}
-
formatTime
public static java.lang.String formatTime(java.time.Instant instant)
-
format
@Deprecated(since="7", forRemoval=true) public static java.lang.String format(java.lang.String levelName, java.lang.String component, java.lang.String componentPrefix, long millis, java.lang.String threadId, java.lang.String serviceName, java.lang.String formattedMessage, java.lang.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(java.lang.Throwable t, java.lang.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 formatsbuf
- The stringbuffer into which we wish to format the Throwable
-
-