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.
Parameters
Returns
build()
Creates a LogEntry
object for this builder.
Returns
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.
Returns
setDestination(LogDestinationName destination)
public LogEntry.Builder setDestination(LogDestinationName destination)
Sets the log path destination name type associated with the log entry.
Parameter
Returns
setHttpRequest(HttpRequest httpRequest)
public LogEntry.Builder setHttpRequest(HttpRequest httpRequest)
Sets information about the HTTP request associated with this log entry, if applicable.
Parameter
Returns
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
|
Returns
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.
Parameter
Returns
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
|
Returns
setOperation(Operation operation)
public LogEntry.Builder setOperation(Operation operation)
Sets information about an operation associated with the log entry, if applicable.
Parameter
Returns
setPayload(Payload<?> payload)
public LogEntry.Builder setPayload(Payload<?> payload)
Parameter
Name |
Description |
payload |
Payload<?>
|
Returns
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
|
Returns
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
|
Returns
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
|
Returns
setSeverity(Severity severity)
public LogEntry.Builder setSeverity(Severity severity)
Parameter
Returns
setSourceLocation(SourceLocation sourceLocation)
public LogEntry.Builder setSourceLocation(SourceLocation sourceLocation)
Sets the source code location information associated with the log entry if any.
Parameter
Returns
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
|
Returns
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
|
Returns
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
Returns
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
|
Returns
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
Returns
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
Returns
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
|
Returns