Module: StatsCloud::LoggerHelper

Included in:
StatsCloud, Client, ClusterClient, RegisterConnectionJob, SocketIOHelper, StatsmeterClient
Defined in:
lib/statscloud/helpers/logger_helper.rb

Overview

This helper works to help log errors and info about StatsCloud service work.

Instance Method Summary collapse

Instance Method Details

#log_error(error_message) ⇒ Object

Logs errors with 10 minutes interval



24
25
26
27
28
# File 'lib/statscloud/helpers/logger_helper.rb', line 24

def log_error(error_message)
  logged = log_with_interval(error_type, last_error_log_at, error_message)
  update_last_error_at && log_stop_logging("errors") if logged
  false
end

#log_info(info_message) ⇒ Object

Logs information with 10 minutes interval



17
18
19
20
21
# File 'lib/statscloud/helpers/logger_helper.rb', line 17

def log_info(info_message)
  logged = log_with_interval(info_type, last_info_log_at, info_message)
  update_last_info_at && log_stop_logging("information") if logged
  true
end

#logger(output = default_output) ⇒ Object

Log information about work to standard output



9
10
11
12
13
14
# File 'lib/statscloud/helpers/logger_helper.rb', line 9

def logger(output = default_output)
  file_utils.mkdir_p "log"
  @logger ||= logger_service.new(output).tap do |log|
    log.progname = "StatsCloud"
  end
end