Package com.google.cloud.logging
Class TraceLoggingEnhancer
- java.lang.Object
-
- com.google.cloud.logging.TraceLoggingEnhancer
-
- All Implemented Interfaces:
LoggingEnhancer
public class TraceLoggingEnhancer extends Object implements LoggingEnhancer
-
-
Constructor Summary
Constructors Constructor Description TraceLoggingEnhancer()
TraceLoggingEnhancer(String prefix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enhanceLogEntry(LogEntry.Builder builder)
static String
getCurrentTraceId()
Get the Trace ID associated with any logging done by the current thread.static void
setCurrentTraceId(String id)
Set the Trace ID associated with any logging done by the current thread.
-
-
-
Constructor Detail
-
TraceLoggingEnhancer
public TraceLoggingEnhancer()
-
TraceLoggingEnhancer
public TraceLoggingEnhancer(String prefix)
-
-
Method Detail
-
setCurrentTraceId
public static void setCurrentTraceId(String id)
Set the Trace ID associated with any logging done by the current thread.- Parameters:
id
- The traceID, in the form projects/[PROJECT_ID]/traces/[TRACE_ID]
-
getCurrentTraceId
public static String getCurrentTraceId()
Get the Trace ID associated with any logging done by the current thread.- Returns:
- id The traceID
-
enhanceLogEntry
public void enhanceLogEntry(LogEntry.Builder builder)
- Specified by:
enhanceLogEntry
in interfaceLoggingEnhancer
-
-