Class: BlackStack::RemoteLogger
- Inherits:
-
BaseLogger
- Object
- BaseLogger
- BlackStack::RemoteLogger
- Defined in:
- lib/remotelogger.rb
Constant Summary
Constants inherited from BaseLogger
BaseLogger::METHODS, BaseLogger::METHOD_LOG, BaseLogger::METHOD_LOGF, BaseLogger::METHOD_LOGS
Instance Attribute Summary collapse
-
#api_domain ⇒ Object
Returns the value of attribute api_domain.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_port ⇒ Object
Returns the value of attribute api_port.
-
#api_protocol ⇒ Object
Returns the value of attribute api_protocol.
-
#id_client ⇒ Object
Returns the value of attribute id_client.
Attributes inherited from BaseLogger
#current_nest_level, #filename, #nest_level, #number_of_lines_in_current_level
Instance Method Summary collapse
-
#initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key, the_id_client = nil) ⇒ RemoteLogger
constructor
A new instance of RemoteLogger.
- #log(s, datetime = nil) ⇒ Object
- #logf(s, datetime = nil) ⇒ Object
- #logs(s, datetime = nil) ⇒ Object
- #release ⇒ Object
-
#reset ⇒ Object
call the parent class to set the attributes call the save method to store the new attributes into the data file.
Methods inherited from BaseLogger
#done, #error, #initialize_attributes, #no, #yes
Constructor Details
#initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key, the_id_client = nil) ⇒ RemoteLogger
Returns a new instance of RemoteLogger.
6 7 8 9 10 11 12 13 |
# File 'lib/remotelogger.rb', line 6 def initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key, the_id_client=nil) super(the_filename) self.api_protocol = the_api_protocol self.api_domain = the_api_domain self.api_port = the_api_port self.api_key = the_api_key self.id_client = the_id_client end |
Instance Attribute Details
#api_domain ⇒ Object
Returns the value of attribute api_domain.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def api_domain @api_domain end |
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def api_key @api_key end |
#api_port ⇒ Object
Returns the value of attribute api_port.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def api_port @api_port end |
#api_protocol ⇒ Object
Returns the value of attribute api_protocol.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def api_protocol @api_protocol end |
#id_client ⇒ Object
Returns the value of attribute id_client.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def id_client @id_client end |
Instance Method Details
#log(s, datetime = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/remotelogger.rb', line 29 def log(s, datetime=nil) ltext = super(s, datetime) =begin url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOG, 'id_client' => self.id_client, }) =end ltext end |
#logf(s, datetime = nil) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/remotelogger.rb', line 59 def logf(s, datetime=nil) ltext = super(s, datetime) =begin url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOGF, 'id_client' => self.id_client, }) =end ltext end |
#logs(s, datetime = nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/remotelogger.rb', line 44 def logs(s, datetime=nil) ltext = super(s, datetime) =begin url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOGS, 'id_client' => self.id_client, }) =end ltext end |
#release ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/remotelogger.rb', line 74 def release() =begin url = "#{self.api_url}:#{self.api_port.to_s}/api1.3/threads/release.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'id_client' => self.id_client, }) =end end |
#reset ⇒ Object
call the parent class to set the attributes call the save method to store the new attributes into the data file
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/remotelogger.rb', line 17 def reset() super =begin url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/reset.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'id_client' => self.id_client, }) =end end |