Class: Shared::Log
Overview
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 ⇒ Object
readonly
The node instance that the log belongs to.
-
#name ⇒ Object
readonly
The name of the log.
Attributes inherited from Resource
Instance Method Summary collapse
-
#content(options = {}, &block) ⇒ Object
The Log’s content.
-
#initialize(location, client, instance_type, instance_class) ⇒ Log
constructor
:nodoc:.
-
#last_modified ⇒ Object
The last_modified stamp of the log.
-
#size ⇒ Object
The size of the log.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(location, client, instance_type, instance_class) ⇒ Log
:nodoc:
38 39 40 41 42 43 44 |
# File 'lib/vas/shared/logs.rb', line 38 def initialize(location, client, instance_type, instance_class) #:nodoc: 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 ⇒ Object (readonly)
The node instance that the log belongs to
36 37 38 |
# File 'lib/vas/shared/logs.rb', line 36 def instance @instance end |
#name ⇒ Object (readonly)
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 = {}, &block) ⇒ Object
The Log’s content. The content that is passed to the block can be controlled using options
.
Recognized options are:
- start_line
-
The start point, in lines, of the content to pass to the block. Omitting the parameter will result in content from the start of the file being passed. If the provided value is greater than the number of lines in the file, no content will be passed.
- end_line
-
The end point, in lines, of the content to pass to the block. Omitting the parameter will result in content up to the end of the file being passed. If the provided value is greater than the number of lines in the file, content up to and including the last line in the file will be passed.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/vas/shared/logs.rb', line 56 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 ⇒ Object
The last_modified stamp of the log
81 82 83 |
# File 'lib/vas/shared/logs.rb', line 81 def last_modified client.get(location)['last-modified'] end |
#size ⇒ Object
The size of the log
76 77 78 |
# File 'lib/vas/shared/logs.rb', line 76 def size client.get(location)['size'] end |
#to_s ⇒ Object
:nodoc:
85 86 87 |
# File 'lib/vas/shared/logs.rb', line 85 def to_s #:nodoc: "#<#{self.class} name='#@name' size'#@size' services='#@last_modified'>" end |