Class LogUtils


  • public final class LogUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String ensureValidLoggerName​(java.lang.String name)
      Returns the short logger tag (up to 23 characters) for the given logger name if the devices API level is <= 25, otherwise, the tag is unchanged.
      static java.lang.String removeNewLinesFromLogMessage​(java.lang.String logMessage)
      Removes CR, LF or CRLF pattern in the logMessage.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ensureValidLoggerName

        public static java.lang.String ensureValidLoggerName​(java.lang.String name)
        Returns the short logger tag (up to 23 characters) for the given logger name if the devices API level is <= 25, otherwise, the tag is unchanged. Traditionally loggers are named by fully-qualified Java classes; this method attempts to return a concise identifying part of such names.
      • removeNewLinesFromLogMessage

        public static java.lang.String removeNewLinesFromLogMessage​(java.lang.String logMessage)
        Removes CR, LF or CRLF pattern in the logMessage.

        This is more performant than using Pattern.compile("[\r\n]").

        Parameters:
        logMessage - The log message to sanitize.
        Returns:
        The updated logMessage.