public final class RuntimeProvider extends Object
Modifier and Type | Method and Description |
---|---|
static Timestamp |
createTimestamp()
Creates a timestamp with the current date and time.
|
static TimestampFormatter |
createTimestampFormatter(String pattern,
Locale locale)
Creates a formatter for
Timestamps . |
static String |
getCallerClassName(int depth)
Gets the class name of a caller from stack trace.
|
static String |
getCallerClassName(String loggerClassName)
Gets the class name of a caller from stack trace.
|
static StackTraceElement |
getCallerStackTraceElement(int depth)
Gets the complete stack trace element of a caller from stack trace.
|
static StackTraceElement |
getCallerStackTraceElement(String loggerClassName)
Gets the complete stack trace element of a caller from stack trace.
|
static ClassLoader |
getClassLoader()
Gets a valid class loader.
|
static String |
getDefaultWriter()
Gets the name of the default writer.
|
static long |
getProcessId()
Gets the ID of the current process (pid).
|
static Timestamp |
getStartTime()
Gets the start time of the Java virtual machine or tinylog.
|
static boolean |
isAndroid()
Checks if running on Android.
|
public static boolean isAndroid()
true
if running on Android, otherwise false
public static ClassLoader getClassLoader()
public static String getDefaultWriter()
public static long getProcessId()
public static Timestamp getStartTime()
public static String getCallerClassName(int depth)
depth
- Position of caller in stack tracepublic static String getCallerClassName(String loggerClassName)
loggerClassName
- Logger class name that should appear before the real callerpublic static StackTraceElement getCallerStackTraceElement(int depth)
depth
- Position of caller in stack tracepublic static StackTraceElement getCallerStackTraceElement(String loggerClassName)
loggerClassName
- Logger class name that should appear before the real callerpublic static Timestamp createTimestamp()
public static TimestampFormatter createTimestampFormatter(String pattern, Locale locale)
Timestamps
.pattern
- Format pattern that is compatible with DateTimeFormatter
locale
- Locale for formattingCopyright © 2020. All rights reserved.