Class: Shared::Log
Overview
abstract A log file in a node instance
Direct Known Subclasses
Gemfire::AgentLog, Gemfire::CacheServerLog, Gemfire::LocatorLog, RabbitMq::Log, TcServer::Log
Instance Attribute Summary collapse
-
#instance ⇒ NodeInstance
readonly
The node instance that the log belongs to.
-
#name ⇒ String
readonly
The name of the log.
Attributes inherited from Resource
Instance Method Summary collapse
-
#content(options = {}) {|chunk| ... } ⇒ void
Retrieve the content of the log.
-
#initialize(location, client, instance_type, instance_class) ⇒ Log
constructor
A new instance of Log.
-
#last_modified ⇒ Integer
The last modified stamp of the log.
-
#size ⇒ Integer
The size of the log.
-
#to_s ⇒ String
A string representation of the log.
Constructor Details
#initialize(location, client, instance_type, instance_class) ⇒ Log
Returns a new instance of Log.
39 40 41 42 43 44 45 |
# File 'lib/vas/shared/logs.rb', line 39 def initialize(location, client, instance_type, instance_class) super(location, client) @name = details['name'] @content_location = Util::LinkUtils.get_link_href(details, 'content') @instance = instance_class.new(Util::LinkUtils.get_link_href(details, instance_type), client) end |
Instance Attribute Details
#instance ⇒ NodeInstance (readonly)
Returns the node instance that the log belongs to.
36 37 38 |
# File 'lib/vas/shared/logs.rb', line 36 def instance @instance end |
#name ⇒ String (readonly)
Returns the name of the log.
33 34 35 |
# File 'lib/vas/shared/logs.rb', line 33 def name @name end |
Instance Method Details
#content(options = {}) {|chunk| ... } ⇒ void
This method returns an undefined value.
Retrieve the content of the log
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vas/shared/logs.rb', line 64 def content( = {}, &block) query="" if (![:start_line].nil?) query << "start-line=#{[:start_line]}" end if (![:end_line].nil?) if (query.length > 0) query << '&' end query << "end-line=#{[:end_line]}" end if (query.length > 0) client.get_stream("#{@content_location}?#{query}", &block) else client.get_stream(@content_location, &block) end end |
#last_modified ⇒ Integer
Returns the last modified stamp of the log.
89 90 91 |
# File 'lib/vas/shared/logs.rb', line 89 def last_modified client.get(location)['last-modified'] end |
#size ⇒ Integer
Returns the size of the log.
84 85 86 |
# File 'lib/vas/shared/logs.rb', line 84 def size client.get(location)['size'] end |
#to_s ⇒ String
Returns a string representation of the log.
94 95 96 |
# File 'lib/vas/shared/logs.rb', line 94 def to_s "#<#{self.class} name='#@name'>" end |