public class LogEntry extends Object implements Serializable
Payload.StringPayload
),
a JSON object (see Payload.JsonPayload
, or a protobuf object (see Payload.ProtoPayload
). Entries can also store additional information about the operation or the
HTTP request that generated the log (see getOperation()
and getHttpRequest()
, respectively).Modifier and Type | Class and Description |
---|---|
static class |
LogEntry.Builder
A builder for
LogEntry objects. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
HttpRequest |
getHttpRequest()
Returns information about the HTTP request associated with this log entry, if applicable.
|
String |
getInsertId()
Returns a unique ID for the log entry.
|
Map<String,String> |
getLabels()
Returns an optional set of user-defined (key, value) data that provides additional information
about the log entry.
|
String |
getLogName()
Returns the name of the log to which this log entry belongs.
|
Operation |
getOperation()
Returns information about an operation associated with the log entry, if applicable.
|
<T extends Payload> |
getPayload()
Returns the payload for this log entry.
|
Long |
getReceiveTimestamp()
Returns the time the log entry was received by Stackdriver Logging.
|
MonitoredResource |
getResource()
Returns the monitored resource associated with this log entry.
|
Severity |
getSeverity()
Returns the severity of the log entry.
|
SourceLocation |
getSourceLocation()
Returns the source code location information associated with the log entry, if any.
|
String |
getSpanId()
Returns the ID of the trace span associated with the log entry, if any.
|
Long |
getTimestamp()
Returns the time at which the event described by the log entry occurred, in milliseconds.
|
String |
getTrace()
Returns the resource name of the trace associated with the log entry, if any.
|
boolean |
getTraceSampled()
Returns the sampling decision of the trace span associated with the log entry, or
false
if there is no trace span. |
int |
hashCode() |
static LogEntry.Builder |
newBuilder(Payload<?> payload)
Returns a builder for
LogEntry objects given the entry payload. |
static LogEntry |
of(Payload<?> payload)
Creates a
LogEntry object given the entry payload. |
static LogEntry |
of(String logName,
MonitoredResource resource,
Payload<?> payload)
Creates a
LogEntry object given the log name, the monitored resource and the entry
payload. |
LogEntry.Builder |
toBuilder()
Returns a
Builder for this log entry. |
String |
toString() |
public String getLogName()
[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
.public MonitoredResource getResource()
public Long getTimestamp()
public Long getReceiveTimestamp()
public Severity getSeverity()
Severity.DEFAULT
is used.public String getInsertId()
public HttpRequest getHttpRequest()
public Map<String,String> getLabels()
public Operation getOperation()
public String getTrace()
public String getSpanId()
public boolean getTraceSampled()
false
if there is no trace span.public SourceLocation getSourceLocation()
public <T extends Payload> T getPayload()
Payload.StringPayload
), a JSON object (see Payload.JsonPayload
, or a protobuf
object (see Payload.ProtoPayload
).public LogEntry.Builder toBuilder()
Builder
for this log entry.public static LogEntry.Builder newBuilder(Payload<?> payload)
LogEntry
objects given the entry payload.public static LogEntry of(String logName, MonitoredResource resource, Payload<?> payload)
LogEntry
object given the log name, the monitored resource and the entry
payload.Copyright © 2019 Google LLC. All rights reserved.