Class: Gcloud::Logging::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/gcloud/logging/entry.rb,
lib/gcloud/logging/entry/list.rb,
lib/gcloud/logging/entry/operation.rb,
lib/gcloud/logging/entry/http_request.rb

Overview

Entry

An individual entry in a log.

Examples:

require "gcloud"

gcloud = Gcloud.new
logging = gcloud.logging
entry = logging.entries.first

Defined Under Namespace

Classes: HttpRequest, List, Operation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntry

Create an empty Entry object.


38
39
40
41
42
43
# File 'lib/gcloud/logging/entry.rb', line 38

def initialize
  @labels = {}
  @resource = Resource.new
  @http_request = HttpRequest.new
  @operation = Operation.new
end

Instance Attribute Details

#http_requestObject (readonly)

Information about the HTTP request associated with this log entry, if applicable.


148
149
150
# File 'lib/gcloud/logging/entry.rb', line 148

def http_request
  @http_request
end

#insert_idObject

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, Cloud Logging will generate a unique ID for this log entry.


133
134
135
# File 'lib/gcloud/logging/entry.rb', line 133

def insert_id
  @insert_id
end

#labelsObject

A set of user-defined data that provides additional information about the log entry.


138
139
140
# File 'lib/gcloud/logging/entry.rb', line 138

def labels
  @labels
end

#log_nameObject

The resource name of the log to which this log entry belongs. The format of the name is projects/<project-id>/logs/<log-id>. e.g. projects/my-projectid/logs/syslog and projects/1234567890/logs/library.googleapis.com%2Fbook_log

The log ID part of resource 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: forward-slash (/), underscore (_), hyphen (-), and period (.). Forward-slash (/) characters in the log ID must be URL-encoded.


56
57
58
# File 'lib/gcloud/logging/entry.rb', line 56

def log_name
  @log_name
end

#operationObject (readonly)

Information about an operation associated with the log entry, if applicable.


153
154
155
# File 'lib/gcloud/logging/entry.rb', line 153

def operation
  @operation
end

#payloadObject

The log entry payload, represented as either a string, a hash (JSON), or a hash (protocol buffer).


143
144
145
# File 'lib/gcloud/logging/entry.rb', line 143

def payload
  @payload
end

#resourceObject (readonly)

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.


63
64
65
# File 'lib/gcloud/logging/entry.rb', line 63

def resource
  @resource
end

#severityObject

The severity of the log entry. The default value is DEFAULT.


72
73
74
# File 'lib/gcloud/logging/entry.rb', line 72

def severity
  @severity
end

#timestampObject

The time the event described by the log entry occurred. If omitted, Cloud Logging will use the time the log entry is written.


68
69
70
# File 'lib/gcloud/logging/entry.rb', line 68

def timestamp
  @timestamp
end

Instance Method Details

#alert?Boolean

Helper method to determine if the severity is ALERT


118
119
120
# File 'lib/gcloud/logging/entry.rb', line 118

def alert?
  severity == "ALERT"
end

#critical?Boolean

Helper method to determine if the severity is CRITICAL


112
113
114
# File 'lib/gcloud/logging/entry.rb', line 112

def critical?
  severity == "CRITICAL"
end

#debug?Boolean

Helper method to determine if the severity is DEBUG


82
83
84
# File 'lib/gcloud/logging/entry.rb', line 82

def debug?
  severity == "DEBUG"
end

#default?Boolean

Helper method to determine if the severity is DEFAULT


76
77
78
# File 'lib/gcloud/logging/entry.rb', line 76

def default?
  severity == "DEFAULT"
end

#emergency?Boolean

Helper method to determine if the severity is EMERGENCY


124
125
126
# File 'lib/gcloud/logging/entry.rb', line 124

def emergency?
  severity == "EMERGENCY"
end

#error?Boolean

Helper method to determine if the severity is ERROR


106
107
108
# File 'lib/gcloud/logging/entry.rb', line 106

def error?
  severity == "ERROR"
end

#info?Boolean

Helper method to determine if the severity is INFO


88
89
90
# File 'lib/gcloud/logging/entry.rb', line 88

def info?
  severity == "INFO"
end

#notice?Boolean

Helper method to determine if the severity is NOTICE


94
95
96
# File 'lib/gcloud/logging/entry.rb', line 94

def notice?
  severity == "NOTICE"
end

#warning?Boolean

Helper method to determine if the severity is WARNING


100
101
102
# File 'lib/gcloud/logging/entry.rb', line 100

def warning?
  severity == "WARNING"
end