public static class LogEntry.Builder
A builder for LogEntry
objects.
Inheritance
Object >
LogEntry.Builder
Methods
addLabel(String key, String value)
public LogEntry.Builder addLabel(String key, String value)
Adds a label to the log entry's labels. Labels are user-defined (key, value) data that
provides additional information about the log entry.
build()
Creates a LogEntry
object for this builder.
clearLabels()
public LogEntry.Builder clearLabels()
Clears all the labels of the log entry. Labels are user-defined (key, value) data that
provides additional information about the log entry.
setDestination(LogDestinationName destination)
public LogEntry.Builder setDestination(LogDestinationName destination)
Sets the log path destination name type associated with the log entry.
setHttpRequest(HttpRequest httpRequest)
public LogEntry.Builder setHttpRequest(HttpRequest httpRequest)
Sets information about the HTTP request associated with this log entry, if applicable.
setInsertId(String insertId)
public LogEntry.Builder setInsertId(String insertId)
Sets a unique ID for the log entry. If you provide this field, the Logging service considers
other log entries in the same log with the same ID as duplicates which can be removed. If
omitted, the Logging service will generate a unique ID for this log entry.
Parameter |
---|
Name | Description |
insertId | String
|
setLabels(Map<String,String> labels)
public 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.
setLogName(String logName)
public LogEntry.Builder setLogName(String logName)
Sets the name of the log to which this log entry belongs. The log name must be less than 512
characters long and can only include the following characters: upper and lower case
alphanumeric characters: [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
.
Parameter |
---|
Name | Description |
logName | String
|
setOperation(Operation operation)
public LogEntry.Builder setOperation(Operation operation)
Sets information about an operation associated with the log entry, if applicable.
setPayload(Payload<?> payload)
public LogEntry.Builder setPayload(Payload<?> payload)
Parameter |
---|
Name | Description |
payload | Payload<?>
|
setReceiveTimestamp(Instant receiveTimestamp)
public LogEntry.Builder setReceiveTimestamp(Instant receiveTimestamp)
Sets the time the log entry was received by Cloud Logging. If omitted, the Logging service
will set the time at which the log entry is received.
Parameter |
---|
Name | Description |
receiveTimestamp | Instant
|
setReceiveTimestamp(long milliseconds) (deprecated)
public LogEntry.Builder setReceiveTimestamp(long milliseconds)
Deprecated. This method is no longer recommended to setup the receive time timestamp.
Use setReceiveTimestamp(Instant) instead.
Sets the time the log entry was received by Cloud Logging, in milliseconds. If omitted, the
Logging service will set the time at which the log entry is received.
Parameter |
---|
Name | Description |
milliseconds | long
|
setResource(MonitoredResource resource)
public LogEntry.Builder setResource(MonitoredResource resource)
Sets the monitored resource associated with this log entry. Example: a log entry that reports
a database error would be associated with the monitored resource designating the particular
database that reported the error.
Parameter |
---|
Name | Description |
resource | com.google.cloud.MonitoredResource
|
setSeverity(Severity severity)
public LogEntry.Builder setSeverity(Severity severity)
Parameter |
---|
Name | Description |
severity | Severity
|
setSourceLocation(SourceLocation sourceLocation)
public LogEntry.Builder setSourceLocation(SourceLocation sourceLocation)
Sets the source code location information associated with the log entry if any.
setSpanId(Object spanId)
public LogEntry.Builder setSpanId(Object spanId)
Sets the ID of the trace span associated with the log entry, if any.
Parameter |
---|
Name | Description |
spanId | Object
|
setSpanId(String spanId)
public LogEntry.Builder setSpanId(String spanId)
Sets the ID of the trace span associated with the log entry, if any.
Parameter |
---|
Name | Description |
spanId | String
|
setTimestamp(Instant timestamp)
public LogEntry.Builder setTimestamp(Instant timestamp)
Sets the time at which the event described by the log entry occurred. If omitted, the Logging
service will use the time at which the log entry is received.
Parameter |
---|
Name | Description |
timestamp | Instant
|
setTimestamp(long milliseconds) (deprecated)
public LogEntry.Builder setTimestamp(long milliseconds)
Deprecated. This method is no longer recommended to setup the entry timestamp.
Use #setTimestamp(Instant) instead.
Sets the time at which the event described by the log entry occurred, in milliseconds. If
omitted, the Logging service will use the time at which the log entry is received.
Parameter |
---|
Name | Description |
milliseconds | long
|
setTrace(Object trace)
public LogEntry.Builder setTrace(Object trace)
Sets the resource name of the trace associated with the log entry, if any. If it contains a
relative resource name, the name is assumed to be relative to //tracing.googleapis.com
.
Parameter |
---|
Name | Description |
trace | Object
|
setTrace(String trace)
public LogEntry.Builder setTrace(String trace)
Sets the resource name of the trace associated with the log entry, if any. If it contains a
relative resource name, the name is assumed to be relative to //tracing.googleapis.com
.
Parameter |
---|
Name | Description |
trace | String
|
setTraceSampled(boolean traceSampled)
public LogEntry.Builder setTraceSampled(boolean traceSampled)
Sets the sampling decision of the trace span associated with the log entry.
Parameter |
---|
Name | Description |
traceSampled | boolean
|