[Obsolete("Use Google.Cloud.Diagnostics.Common.ITraceContext instead.")]public sealed class TraceContextForLogEntry
Represents a trace context (Trace ID and Span ID)
for a log entry.
These values can be attached to a log entry to establish the
relation of it and a trace.
For this to be matched to a span being stored in Google Cloud Trace,
its format should be the same that the Trace API v2 uses: a 16-character hexadecimal
encoding of an 8-byte array, such as 000000000000004a. A check is not performed
to ensure this format is used, so as to allow for this value to refer to spans other
than those stored in Google Cloud Trace.
TraceId
public string TraceId { get; }
The trace ID to associate the log entry with.
Must not be null.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e represents a trace context, comprising a Trace ID and Span ID, used to link log entries with traces.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e class is now obsolete and \u003ccode\u003eGoogle.Cloud.Diagnostics.Common.ITraceContext\u003c/code\u003e should be used instead.\u003c/p\u003e\n"],["\u003cp\u003eYou can construct a \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e using a \u003ccode\u003etraceId\u003c/code\u003e and \u003ccode\u003espanId\u003c/code\u003e, where \u003ccode\u003etraceId\u003c/code\u003e is mandatory, but the \u003ccode\u003espanId\u003c/code\u003e can be null if no span is present.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSpanId\u003c/code\u003e property is a string that is a 16 character hexadecimal, and the \u003ccode\u003eTraceId\u003c/code\u003e is a string to associate with the log entry.\u003c/p\u003e\n"],["\u003cp\u003eIt has a variety of versions listed, with 5.2.0 being the most recent.\u003c/p\u003e\n"]]],[],null,[]]