Class: BlackStack::RemoteLogger
- Inherits:
-
BaseLogger
- Object
- BaseLogger
- BlackStack::RemoteLogger
- Defined in:
- lib/remotelogger.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_port ⇒ Object
Returns the value of attribute api_port.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
Instance Method Summary collapse
-
#initialize(the_filename, the_api_url, the_api_port, the_api_key) ⇒ RemoteLogger
constructor
A new instance of RemoteLogger.
- #log(s) ⇒ Object
- #logf(s) ⇒ Object
- #logs(s) ⇒ Object
- #release ⇒ Object
Constructor Details
#initialize(the_filename, the_api_url, the_api_port, the_api_key) ⇒ RemoteLogger
Returns a new instance of RemoteLogger.
6 7 8 9 10 11 |
# File 'lib/remotelogger.rb', line 6 def initialize(the_filename, the_api_url, the_api_port, the_api_key) super(the_filename) self.api_url = the_api_url self.api_port = the_api_port self.api_key = the_api_key end |
Instance Attribute Details
#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_url ⇒ Object
Returns the value of attribute api_url.
4 5 6 |
# File 'lib/remotelogger.rb', line 4 def api_url @api_url end |
Instance Method Details
#log(s) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/remotelogger.rb', line 13 def log(s) ltext = super(s) url = "#{self.api_url}:#{self.api_port}/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) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/remotelogger.rb', line 37 def logf(s) ltext = super(s) url = "#{self.api_url}:#{self.api_port}/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) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/remotelogger.rb', line 25 def logs(s) ltext = super(s) url = "#{self.api_url}:#{self.api_port}/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
49 50 51 52 53 54 55 |
# File 'lib/remotelogger.rb', line 49 def release() url = "#{self.api_url}:#{self.api_port}/api1.4/scl/release.json" res = BlackStack::Netting::api_call(url, { 'api_key' => self.api_key, 'filename' => self.filename, }) end |