Sha256: e090e2e101b4f5d42dd55bce6b888a970a63fa87e7937b3db4ab448bff05b77c
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
module Stackify class LoggerClient def initialize begin @@errors_governor = Stackify::ErrorsGovernor.new @@transport = Stackify::TransportSelector.new(Stackify.configuration.transport).transport Stackify.internal_log :info, "[LoggerClient] initialize: #{@@transport}" return if @@transport.nil? rescue => ex Stackify.log_internal_error "[LoggerClient] initialize exception = #{ex.inspect}" end end def log level, msg, call_trace return if @@transport.nil? task = log_message_task level, msg, call_trace @@transport.log level, msg, call_trace, task end def log_exception level= :error, ex return if @@transport.nil? task = log_exception_task level, ex @@transport.log_exception level, ex, task end def get_transport return if @@transport.nil? @@transport end private def acceptable? level, msg Stackify.is_valid? && is_correct_log_level?(level) && is_not_internal_log_message?(msg) end def is_not_internal_log_message? msg msg.try(:index, ::Stackify::INTERNAL_LOG_PREFIX).nil? end def is_correct_log_level? level config_level = Logger.const_get Stackify.configuration.log_level.to_s.upcase current_level = Logger.const_get level.to_s.upcase current_level >= config_level end def log_message_task level, msg, call_trace, trans_id=nil, log_uuid=nil return if @@transport.nil? @@transport.log_message_task level, msg, call_trace, trans_id, log_uuid end def log_exception_task level, ex, trans_id=nil, log_uuid=nil return if @@transport.nil? @@transport.log_exception_task level, ex, trans_id, log_uuid end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stackify-api-ruby-1.2.7 | lib/stackify/logger_client.rb |
stackify-api-ruby-1.2.4 | lib/stackify/logger_client.rb |