- Enclosing interface:
LogEvent
public static sealed interface LogEvent.Caller
Caller info usually derived from Stack walking.
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
freeze()
Make the caller info immutable.int
static LogEvent.Caller
of
(StackWalker.StackFrame stackFrame) Creates caller info from a stack frame.static @Nullable LogEvent.Caller
ofDepthOrNull
(int depth) Returns caller from a certain depth ornull
static String
toString
(@Nullable LogEvent.Caller caller) Convenience toString for caller.
-
Method Details
-
of
Creates caller info from a stack frame.- Parameters:
stackFrame
- stack frame must haveStackWalker.Option.RETAIN_CLASS_REFERENCE
.- Returns:
- caller info.
-
ofDepthOrNull
Returns caller from a certain depth ornull
- Parameters:
depth
- how deep in the stack to pull stack frame.- Returns:
- caller or
null
.
-
className
- Returns:
- class name.
-
fileNameOrNull
@Nullable String fileNameOrNull()- Returns:
- file name.
-
lineNumber
int lineNumber()- Returns:
- line number.
-
methodName
- Returns:
- method name.
-
freeze
Make the caller info immutable.- Returns:
- immutable caller info and if this is already immutable return this.
-
toString
Convenience toString for caller.- Parameters:
caller
- if caller isnull
the string "null" will be returned.- Returns:
- string representation.
-