Class TraceLoggingEnhancer

java.lang.Object
com.google.cloud.logging.TraceLoggingEnhancer
All Implemented Interfaces:
LoggingEnhancer

public class TraceLoggingEnhancer extends Object implements LoggingEnhancer
  • Constructor Details

    • TraceLoggingEnhancer

      public TraceLoggingEnhancer()
    • TraceLoggingEnhancer

      public TraceLoggingEnhancer(String prefix)
  • Method Details

    • 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 interface LoggingEnhancer