Modifier and Type | Method and Description |
---|---|
LogEntry.Builder |
addLabel(String key,
String value)
Adds a label to the log entry's labels.
|
LogEntry |
build()
Creates a
LogEntry object for this builder. |
LogEntry.Builder |
clearLabels()
Clears all the labels of the log entry.
|
LogEntry.Builder |
setDestination(LogDestinationName destination)
Sets the log path destination name type associated with the log entry.
|
LogEntry.Builder |
setHttpRequest(HttpRequest httpRequest)
Sets information about the HTTP request associated with this log entry, if applicable.
|
LogEntry.Builder |
setInsertId(String insertId)
Sets a unique ID for the log entry.
|
LogEntry.Builder |
setLabels(Map<String,String> labels)
Sets an optional set of user-defined (key, value) data that provides additional information
about the log entry.
|
LogEntry.Builder |
setLogName(String logName)
Sets the name of the log to which this log entry belongs.
|
LogEntry.Builder |
setOperation(Operation operation)
Sets information about an operation associated with the log entry, if applicable.
|
LogEntry.Builder |
setPayload(Payload<?> payload)
Sets the payload for this log entry.
|
LogEntry.Builder |
setReceiveTimestamp(Instant receiveTimestamp)
Sets the time the log entry was received by Cloud Logging.
|
LogEntry.Builder |
setReceiveTimestamp(long milliseconds)
Deprecated.
This method is no longer recommended to setup the receive time timestamp.
Use |
LogEntry.Builder |
setResource(com.google.cloud.MonitoredResource resource)
Sets the monitored resource associated with this log entry.
|
LogEntry.Builder |
setSeverity(Severity severity)
Sets the severity of the log entry.
|
LogEntry.Builder |
setSourceLocation(SourceLocation sourceLocation)
Sets the source code location information associated with the log entry if any.
|
LogEntry.Builder |
setSpanId(Object spanId)
Sets the ID of the trace span associated with the log entry, if any.
|
LogEntry.Builder |
setSpanId(String spanId)
Sets the ID of the trace span associated with the log entry, if any.
|
LogEntry.Builder |
setTimestamp(Instant timestamp)
Sets the time at which the event described by the log entry occurred.
|
LogEntry.Builder |
setTimestamp(long milliseconds)
Deprecated.
This method is no longer recommended to setup the entry timestamp.
Use |
LogEntry.Builder |
setTrace(Object trace)
Sets the resource name of the trace associated with the log entry, if any.
|
LogEntry.Builder |
setTrace(String trace)
Sets the resource name of the trace associated with the log entry, if any.
|
LogEntry.Builder |
setTraceSampled(boolean traceSampled)
Sets the sampling decision of the trace span associated with the log entry.
|
@CanIgnoreReturnValue public LogEntry.Builder setLogName(String logName)
[A-Za-z0-9]
; and punctuation characters: _-./
. The
forward-slash (/
) characters in the log name must be URL-encoded. Examples: syslog
, library.googleapis.com%2Fbook_log
.@CanIgnoreReturnValue public LogEntry.Builder setResource(com.google.cloud.MonitoredResource resource)
@CanIgnoreReturnValue @Deprecated public LogEntry.Builder setTimestamp(long milliseconds)
Use setTimestamp(Instant)
instead.
@CanIgnoreReturnValue public LogEntry.Builder setTimestamp(Instant timestamp)
@CanIgnoreReturnValue @Deprecated public LogEntry.Builder setReceiveTimestamp(long milliseconds)
Use setReceiveTimestamp(Instant)
instead.
@CanIgnoreReturnValue public LogEntry.Builder setReceiveTimestamp(Instant receiveTimestamp)
@CanIgnoreReturnValue public LogEntry.Builder setSeverity(Severity severity)
Severity.DEFAULT
is used.@CanIgnoreReturnValue public LogEntry.Builder setInsertId(String insertId)
@CanIgnoreReturnValue public LogEntry.Builder setHttpRequest(HttpRequest httpRequest)
@CanIgnoreReturnValue public LogEntry.Builder setLabels(Map<String,String> labels)
@CanIgnoreReturnValue public LogEntry.Builder addLabel(String key, String value)
@CanIgnoreReturnValue public LogEntry.Builder clearLabels()
@CanIgnoreReturnValue public LogEntry.Builder setOperation(Operation operation)
@CanIgnoreReturnValue public LogEntry.Builder setTrace(String trace)
@CanIgnoreReturnValue public LogEntry.Builder setTrace(Object trace)
@CanIgnoreReturnValue public LogEntry.Builder setSpanId(String spanId)
@CanIgnoreReturnValue public LogEntry.Builder setSpanId(Object spanId)
@CanIgnoreReturnValue public LogEntry.Builder setTraceSampled(boolean traceSampled)
@CanIgnoreReturnValue public LogEntry.Builder setSourceLocation(SourceLocation sourceLocation)
@CanIgnoreReturnValue public LogEntry.Builder setPayload(Payload<?> payload)
Payload.StringPayload
), a JSON object (see Payload.JsonPayload
, or a
protobuf object (see Payload.ProtoPayload
).@CanIgnoreReturnValue public LogEntry.Builder setDestination(LogDestinationName destination)
public LogEntry build()
LogEntry
object for this builder.Copyright © 2023 Google LLC. All rights reserved.