Enum StackSize
- java.lang.Object
-
- java.lang.Enum<StackSize>
-
- com.google.common.flogger.StackSize
-
- All Implemented Interfaces:
Serializable,Comparable<StackSize>
public enum StackSize extends Enum<StackSize>
Enum values to be passed intoGoogleLoggingApi#withStackTraceto control the maximum number of stack trace elements created.Note that the precise value returned by
getMaxDepth()may change over time, but it can be assumed thatSMALL <= MEDIUM <= LARGE <= FULL.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FULLProvides the complete stack trace.LARGEProduces a large stack suitable for providing highly detailed contextual information.MEDIUMProduces a medium sized stack suitable for providing contextual information for most log statements atWARNINGor above.NONEProvides no stack trace, making thewithStackTrace()method an effective no-op.SMALLProduces a small stack suitable for more fine grained debugging.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StackSizevalueOf(String name)Returns the enum constant of this type with the specified name.static StackSize[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SMALL
public static final StackSize SMALL
Produces a small stack suitable for more fine grained debugging. For performance reasons, this is the only stack size suitable for log statements at levelINFOor finer, but is may also be useful forWARNINGlevel log statements in cases where context is not as important. ForSEVERElog statements, it is advised to use a stack size ofMEDIUMor above.Requesting a small stack trace for log statements which occur under normal circumstances is acceptable, but may affect performance. Consider using
GoogleLoggingApi#withStackTrace(StackSize)in conjunction with rate limiting methods, such asLoggingApi.atMostEvery(int, TimeUnit), to mitigate performance issues.The current maximum size of a
SMALLstack trace is 10 elements, but this may change.
-
MEDIUM
public static final StackSize MEDIUM
Produces a medium sized stack suitable for providing contextual information for most log statements atWARNINGor above. There should be enough stack trace elements in aMEDIUMstack to provide sufficient debugging context in most cases.Requesting a medium stack trace for any log statements which can occur regularly under normal circumstances is not recommended.
The current maximum size of a
MEDIUMstack trace is 20 elements, but this may change.
-
LARGE
public static final StackSize LARGE
Produces a large stack suitable for providing highly detailed contextual information. This is most useful forSEVERElog statements which might be processed by external tools and subject to automated analysis.Requesting a large stack trace for any log statement which can occur under normal circumstances is not recommended.
The current maximum size of a
LARGEstack trace is 50 elements, but this may change.
-
FULL
public static final StackSize FULL
Provides the complete stack trace. This is included for situations in which it is known that the upper-most elements of the stack are definitely required for analysis.Requesting a full stack trace for any log statement which can occur under normal circumstances is not recommended.
-
NONE
public static final StackSize NONE
Provides no stack trace, making thewithStackTrace()method an effective no-op. This is useful when your stack size is conditional. For example:logger.atWarning() .withStackTrace(showTrace ? StackSize.MEDIUM : StackSize.NONE) .log("message");
-
-
Method Detail
-
values
public static StackSize[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (StackSize c : StackSize.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static StackSize valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
-