# Class TraceLoggingEnhancer (3.34.0)

3.34.0 (latest) 3.32.0 3.29.0 3.28.0 3.26.0 3.24.0 3.23.10 3.22.6 3.21.4 3.20.7 3.19.0 3.18.0 3.17.2 3.16.2 3.15.17 3.14.9 3.13.7 3.12.1 3.11.10 3.10.7 3.9.0 3.8.0 3.7.6 3.6.4 3.5.3

    public class TraceLoggingEnhancer implements LoggingEnhancer

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> TraceLoggingEnhancer

## Implements

[LoggingEnhancer](https://docs.cloud.google.com/java/docs/reference/google-cloud-logging/latest/com.google.cloud.logging.LoggingEnhancer)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### getCurrentSpanId()

    public static String getCurrentSpanId()

Get the Span ID associated with any logging done by the current thread.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | id The span ID |

### getCurrentTraceId()

    public static String getCurrentTraceId()

Get the Trace ID associated with any logging done by the current thread.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | id The trace ID |

### getCurrentTraceSampled()

    public static Boolean getCurrentTraceSampled()

Get the trace sampled flag associated with any logging done by the current thread.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html` | traceSampled The traceSampled flag |

### setCurrentSpanId(String id)

    public static void setCurrentSpanId(String id)

Set the Span ID associated with any logging done by the current thread.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `id` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The spanID |

### setCurrentTraceId(String id)

    public static void setCurrentTraceId(String id)

Set the Trace ID associated with any logging done by the current thread.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `id` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The traceID, in the form projects/\[PROJECT_ID\]/traces/\[TRACE_ID\] |

### setCurrentTraceSampled(Boolean isTraceSampled)

    public static void setCurrentTraceSampled(Boolean isTraceSampled)

Set the trace sampled flag associated with any logging done by the current thread.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `isTraceSampled` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html` The traceSampled flag |

## Constructors

### TraceLoggingEnhancer()

    public TraceLoggingEnhancer()

### TraceLoggingEnhancer(String prefix)

    public TraceLoggingEnhancer(String prefix)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `prefix` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

## Methods

### enhanceLogEntry(LogEntry.Builder builder)

    public void enhanceLogEntry(LogEntry.Builder builder)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `builder` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-logging/latest/com.google.cloud.logging.LogEntry.Builder` |