Class: BlackStack::RemoteLogger
- Inherits:
-
BaseLogger
- Object
- BaseLogger
- BlackStack::RemoteLogger
- Defined in:
- lib/remotelogger.rb
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.
Instance Method Summary collapse
-
#initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key) ⇒ 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.
Constructor Details
#initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key) ⇒ RemoteLogger
Returns a new instance of RemoteLogger.
6 7 8 9 10 11 12 |
# File 'lib/remotelogger.rb', line 6 def initialize(the_filename, the_api_protocol, the_api_domain, the_api_port, the_api_key) 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 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 |
Instance Method Details
#log(s, datetime = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/remotelogger.rb', line 25 def log(s, datetime=nil) ltext = super(s, datetime) url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.4/scl/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOG, }) ltext end |
#logf(s, datetime = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/remotelogger.rb', line 49 def logf(s, datetime=nil) ltext = super(s, datetime) url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.4/scl/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOGF, }) ltext end |
#logs(s, datetime = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/remotelogger.rb', line 37 def logs(s, datetime=nil) ltext = super(s, datetime) url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.4/scl/log.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, 'text' => s, 'method' => BlackStack::BaseLogger::METHOD_LOGS, }) ltext end |
#release ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/remotelogger.rb', line 61 def release() url = "#{self.api_url}:#{self.api_port.to_s}/api1.4/scl/release.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, }) end |
#reset ⇒ Object
call the parent class to set the attributes call the save method to store the new attributes into the data file
16 17 18 19 20 21 22 23 |
# File 'lib/remotelogger.rb', line 16 def reset() super url = "#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.4/scl/reset.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, }) end |