Module: SpeakingApps
- Defined in:
- lib/speaking_apps.rb,
lib/speaking_apps/config.rb,
lib/speaking_apps/daemon/remote.rb,
lib/speaking_apps/message_queue.rb,
lib/speaking_apps/daemon/queue_service.rb
Overview
This is the place to read about the methods that will help you sending Messages/Logs to the SpeakingApps API Service.
Please make sure you set the required SpeakingApps::Config values.
Defined Under Namespace
Modules: Daemon Classes: Config, MessageQueue
Class Method Summary collapse
-
.ensure_existence_of_service_daemon ⇒ Object
:nodoc:.
-
.init(environment = nil) ⇒ Object
:nodoc:.
-
.log(message, *tags) ⇒ Object
Send a Messages.
-
.log_with_tags(*tags, &block) ⇒ Object
Send a Messages with tags.
-
.message_queue ⇒ Object
:nodoc:.
- .send_to_app(message) ⇒ Object
Class Method Details
.ensure_existence_of_service_daemon ⇒ Object
:nodoc:
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/speaking_apps.rb', line 50 def ensure_existence_of_service_daemon #:nodoc: begin Timeout::timeout(10) do unless .ping bin_path = File.(File.join(File.dirname(__FILE__), '/../bin/speaking-apps')) Kernel.system("#{bin_path} start") end sleep 1 end send_to_app "=> SpeakingApps: API service ready." rescue send_to_app "=> SpeakingApps: API service is not available!" end end |
.init(environment = nil) ⇒ Object
:nodoc:
13 14 15 16 17 18 |
# File 'lib/speaking_apps.rb', line 13 def init(environment = nil) #:nodoc: unless class_variable_defined?(:@@_message_queue) @@_message_queue = SpeakingApps::MessageQueue.new(environment) ensure_existence_of_service_daemon# if @@_message_queue.environment_valid? end end |
.log(message, *tags) ⇒ Object
Send a Messages. You can optionally assign Tags.
-
SpeakingApps.log('hello World')
-
SpeakingApps.log('hello World', 'tag1', 'tag2', 'tagx')
24 25 26 27 28 29 30 31 |
# File 'lib/speaking_apps.rb', line 24 def log(, *) begin .add(, ) true rescue false end end |
.log_with_tags(*tags, &block) ⇒ Object
Send a Messages with tags.
-
SpeakingApps.log_with_tags('tag1', 'tag2') { 'Hello World' }
36 37 38 39 40 41 42 43 44 |
# File 'lib/speaking_apps.rb', line 36 def (*, &block) begin = yield .add(, ) true rescue false end end |
.message_queue ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/speaking_apps.rb', line 46 def #:nodoc: @@_message_queue end |
.send_to_app(message) ⇒ Object
65 66 67 |
# File 'lib/speaking_apps.rb', line 65 def send_to_app() $stdout.puts end |