serial

## Class Log

- java.lang.Object
- - serial.Log

    public final class Log
    extends java.lang.Object

Log replacement for `android.util.Log`.

### Field Summary

Fields
`static int` `ALL` Priority constant for enable all loggings.
`static int` `ASSERT` Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method.
`static int` `DEBUG` Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.d.
`static int` `ERROR` Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.e.
`static int` `INFO` Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.i.
`static int` `NONE` Priority constant for disable all loggings.
`static int` `VERBOSE` Priority constant for `println(int, String, String)` or `setFilterLevel(int)` methods; use Log.v.
`static int` `WARN` Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.w.

### Method Summary

Methods
`static int` `d(java.lang.String msg)` Send a `DEBUG` log message.
`static int` `d(java.lang.String tag, java.lang.String msg)` Send a `DEBUG` log message.
`static int` `d(java.lang.String tag, java.lang.String format, java.lang.Object... args)` Send a `DEBUG` log message.
`static int` `d(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)` Send a `DEBUG` log message and log the exception.
`static int` `e(java.lang.String msg)` Send an `ERROR` log message.
`static int` `e(java.lang.String tag, java.lang.String msg)` Send an `ERROR` log message.
`static int` `e(java.lang.String tag, java.lang.String format, java.lang.Object... args)` Send an `ERROR` log message.
`static int` `e(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)` Send a `ERROR` log message and log the exception.
`static int` `e(java.lang.String msg, java.lang.Throwable tr)` Send a `ERROR` log message and log the exception.
`static int` `e(java.lang.Throwable tr)` Send an `ERROR` log message.
`static java.lang.String` `getApplicationTag()` Gets the default tag of the application.
`static java.lang.StackTraceElement` `getCallerFrame()` Return the `StackTraceElement` for current method's caller.
`static java.lang.StackTraceElement` `getCurrentFrame()` Return the `StackTraceElement` for current method.
`static int` `getFilterLevel()` Gets the filter level of logs.
`static java.lang.StackTraceElement` `getStackFrameAt(int offset)` Return specified `StackTraceElement` on the call stack, relative to current method.
`static java.lang.String` `getStackTraceString(java.lang.Throwable tr)` Handy function to get a loggable stack trace from a Throwable
`static int` `i(java.lang.String msg)` Send an `INFO` log message.
`static int` `i(java.lang.String tag, java.lang.String msg)` Send an `INFO` log message.
`static int` `i(java.lang.String tag, java.lang.String format, java.lang.Object... args)` Send an `INFO` log message.
`static int` `i(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)` Send a `INFO` log message and log the exception.
`static boolean` `isLoggable(java.lang.String tag, int level)` Checks to see whether or not a log for the specified tag is loggable at the specified level.
`static void` `myAssert(boolean condition, java.lang.String message)`
`static int` `println(int priority, java.lang.String tag, java.lang.String msg)` Low-level logging call.
`static void` `setApplicationTag(java.lang.String tag)` Set the default tag for this application.
`static void` `setFilterLevel(int level)` Sets the filter level of logs.
`static int` `v(java.lang.String msg)` Send a `VERBOSE` log message.
`static int` `v(java.lang.String tag, java.lang.String msg)` Send a `VERBOSE` log message.
`static int` `v(java.lang.String tag, java.lang.String format, java.lang.Object... args)` Send a `VERBOSE` log message.
`static int` `v(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)` Send a `VERBOSE` log message and log the exception.
`static int` `w(java.lang.String msg)` Send a `WARN` log message.
`static int` `w(java.lang.String tag, java.lang.String msg)` Send a `WARN` log message.
`static int` `w(java.lang.String tag, java.lang.String format, java.lang.Object... args)` Send a `WARN` log message.
`static int` `w(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)` Send a `WARN` log message and log the exception.
`static int` `w(java.lang.String tag, java.lang.Throwable tr)`
`static int` `w(java.lang.Throwable tr)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ALL

    public static final int ALL

Priority constant for enable all loggings.

See Also:
  Constant Field Values

#### VERBOSE

    public static final int VERBOSE

Priority constant for `println(int, String, String)` or `setFilterLevel(int)` methods; use Log.v.

See Also:
  Constant Field Values

#### DEBUG

    public static final int DEBUG

Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.d.

See Also:
  Constant Field Values

#### INFO

    public static final int INFO

Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.i.

See Also:
  Constant Field Values

#### WARN

    public static final int WARN

Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.w.

See Also:
  Constant Field Values

#### ERROR

    public static final int ERROR

Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method; use Log.e.

See Also:
  Constant Field Values

#### ASSERT

    public static final int ASSERT

Priority constant for the `println(int, String, String)` or `setFilterLevel(int)` method.

See Also:
  Constant Field Values

#### NONE

    public static final int NONE

Priority constant for disable all loggings.

See Also:
  Constant Field Values

### Method Detail

#### setApplicationTag

    public static void setApplicationTag(java.lang.String tag)

Set the default tag for this application.

Parameters:
  `tag` - The tag of the application.

#### getApplicationTag

    public static java.lang.String getApplicationTag()

Gets the default tag of the application.

Returns:
  The default tag of the application.

#### setFilterLevel

    public static void setFilterLevel(int level)

Sets the filter level of logs. Only levels greater or equals this level will be output to LogCat.

Parameters:
  `level` - The filter level.

#### getFilterLevel

    public static int getFilterLevel()

Gets the filter level of logs. Only levels greater or equals this level will be output to LogCat.

Returns:
  Current filter level.

#### v

    public static int v(java.lang.String msg)

Send a `VERBOSE` log message.

Parameters:
  `msg` - The message you would like logged.

#### v

    public static int v(java.lang.String tag,
        java.lang.String msg)

Send a `VERBOSE` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.

#### v

    public static int v(java.lang.String tag,
        java.lang.String format,
        java.lang.Object... args)

Send a `VERBOSE` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `format` - The format of the message you would like logged.
  `args` - The arguments used to format the message.

#### v

    public static int v(java.lang.String tag,
        java.lang.String msg,
        java.lang.Throwable tr)

Send a `VERBOSE` log message and log the exception.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### d

    public static int d(java.lang.String msg)

Send a `DEBUG` log message.

Parameters:
  `msg` - The message you would like logged.

#### d

    public static int d(java.lang.String tag,
        java.lang.String msg)

Send a `DEBUG` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.

#### d

    public static int d(java.lang.String tag,
        java.lang.String format,
        java.lang.Object... args)

Send a `DEBUG` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `format` - The format of the message you would like logged.
  `args` - The arguments used to format the message.

#### d

    public static int d(java.lang.String tag,
        java.lang.String msg,
        java.lang.Throwable tr)

Send a `DEBUG` log message and log the exception.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### i

    public static int i(java.lang.String msg)

Send an `INFO` log message.

Parameters:
  `msg` - The message you would like logged.

#### i

    public static int i(java.lang.String tag,
        java.lang.String msg)

Send an `INFO` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.

#### i

    public static int i(java.lang.String tag,
        java.lang.String format,
        java.lang.Object... args)

Send an `INFO` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `format` - The format of the message you would like logged.
  `args` - The arguments used to format the message.

#### i

    public static int i(java.lang.String tag,
        java.lang.String msg,
        java.lang.Throwable tr)

Send a `INFO` log message and log the exception.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### w

    public static int w(java.lang.String msg)

Send a `WARN` log message.

Parameters:
  `msg` - The message you would like logged.

#### w

    public static int w(java.lang.String tag,
        java.lang.String msg)

Send a `WARN` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.

#### w

    public static int w(java.lang.String tag,
        java.lang.String format,
        java.lang.Object... args)

Send a `WARN` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `format` - The format of the message you would like logged.
  `args` - The arguments used to format the message.

#### w

    public static int w(java.lang.String tag,
        java.lang.String msg,
        java.lang.Throwable tr)

Send a `WARN` log message and log the exception.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### isLoggable

    public static boolean isLoggable(java.lang.String tag,
                     int level)

Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag.<YOUR_LOG_TAG> <LEVEL>' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.<YOUR_LOG_TAG>=<LEVEL>' and place that in /data/local.prop.

Parameters:
  `tag` - The tag to check.
  `level` - The level to check.
Returns:
  Whether or not that this is allowed to be logged.
Throws:
  `java.lang.IllegalArgumentException` - is thrown if the tag.length() > 23.

#### w

    public static int w(java.lang.String tag,
        java.lang.Throwable tr)

#### w

    public static int w(java.lang.Throwable tr)

#### e

    public static int e(java.lang.String tag,
        java.lang.String format,
        java.lang.Object... args)

Send an `ERROR` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `format` - The format of the message you would like logged.
  `args` - The arguments used to format the message.

#### e

    public static int e(java.lang.String msg)

Send an `ERROR` log message.

Parameters:
  `msg` - The message you would like logged.

#### e

    public static int e(java.lang.Throwable tr)

Send an `ERROR` log message.

Parameters:
  `tr` - The throwable you would like logged.

#### e

    public static int e(java.lang.String tag,
        java.lang.String msg)

Send an `ERROR` log message.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.

#### e

    public static int e(java.lang.String msg,
        java.lang.Throwable tr)

Send a `ERROR` log message and log the exception.

Parameters:
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### e

    public static int e(java.lang.String tag,
        java.lang.String msg,
        java.lang.Throwable tr)

Send a `ERROR` log message and log the exception.

Parameters:
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
  `tr` - An exception to log

#### getStackTraceString

    public static java.lang.String getStackTraceString(java.lang.Throwable tr)

Handy function to get a loggable stack trace from a Throwable

Parameters:
  `tr` - An exception to log

#### println

    public static int println(int priority,
              java.lang.String tag,
              java.lang.String msg)

Low-level logging call.

Parameters:
  `priority` - The priority/type of this log message
  `tag` - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
  `msg` - The message you would like logged.
Returns:
  The number of bytes written.

#### myAssert

    public static void myAssert(boolean condition,
                java.lang.String message)

#### getCallerFrame

    public static java.lang.StackTraceElement getCallerFrame()

Return the `StackTraceElement` for current method's caller.

For example:

     void foo() {
         bar();
     }

     void bar() {
         StackTraceElement caller = getCallerFrame();

         // Will print "foo".
         System.println(caller.getMethodName());
     }

Might be `null`. If you call this from static void main(String[]).

Returns:
  the stack frame of current method's caller.

#### getCurrentFrame

    public static java.lang.StackTraceElement getCurrentFrame()

Return the `StackTraceElement` for current method.

For example:

     void foo() {
         bar();
     }

     void bar() {
         StackTraceElement current = getCurrentFrame();

         // Will print "bar".
         System.println(current.getMethodName());
     }

Returns:
  the stack frame of current method's caller.

#### getStackFrameAt

    public static java.lang.StackTraceElement getStackFrameAt(int offset)

Return specified `StackTraceElement` on the call stack, relative to current method.

For example:

     void main() {
         stub();
     }

     void stub() {
         foo();
     }
     void foo() {
         bar();
     }

     void bar() {
         // Will print "bar"
         System.println(getStackFrameAt(0).getMethodName());
         // Will print "foo"
         System.println(getStackFrameAt(1).getMethodName());
         // Will print "stub"
         System.println(getStackFrameAt(2).getMethodName());
         // Will print "main"
         System.println(getStackFrameAt(3).getMethodName());
         // Will print "null"
         System.println(getStackFrameAt(4));
         System.println(getStackFrameAt(-1));
     }

Parameters:
  `offset` - the offset of the call stack from current method. 0 means current methods, 1 means caller, etc.
Returns:
  the stack frame of current method's caller.