Class: Ably::Logger
- Inherits:
-
Object
- Object
- Ably::Logger
- Extended by:
- Forwardable
- Defined in:
- lib/submodules/ably-ruby/lib/ably/logger.rb
Overview
Logger unifies logging for #debug, #info, #warn, #error, and #fatal messages. A new Ably client uses this Logger and sets the appropriate log level. A custom Logger can be configured when instantiating the client, refer to the Rest::Client and Realtime::Client documentation
Instance Attribute Summary collapse
-
#custom_logger ⇒ nil, Object
readonly
If a custom logger is being used with this Logger, this property is not nil.
-
#log_level ⇒ Integer
readonly
The log level ranging from DEBUG to FATAL, refer to www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html.
-
#logger ⇒ Object, Logger
readonly
The logger used by this class, defaults to Ruby Logger.
Instance Method Summary collapse
-
#initialize(client, log_level, custom_logger = nil) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(client, log_level, custom_logger = nil) ⇒ Logger
Returns a new instance of Logger.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/submodules/ably-ruby/lib/ably/logger.rb', line 14 def initialize(client, log_level, custom_logger = nil) @client = client @custom_logger = custom_logger @logger = custom_logger || default_logger @log_level = log_level ensure_logger_interface_is_valid @logger.level = log_level @log_mutex = Mutex.new end |
Instance Attribute Details
#custom_logger ⇒ nil, Object (readonly)
If a custom logger is being used with this Logger, this property is not nil
33 34 35 |
# File 'lib/submodules/ably-ruby/lib/ably/logger.rb', line 33 def custom_logger @custom_logger end |
#log_level ⇒ Integer (readonly)
The log level ranging from DEBUG to FATAL, refer to www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html
37 38 39 |
# File 'lib/submodules/ably-ruby/lib/ably/logger.rb', line 37 def log_level @log_level end |
#logger ⇒ Object, Logger (readonly)
The logger used by this class, defaults to Ruby Logger
29 30 31 |
# File 'lib/submodules/ably-ruby/lib/ably/logger.rb', line 29 def logger @logger end |