Module: Applitools::EyesLogger
- Extended by:
- EyesLogger, Forwardable
- Included in:
- EyesLogger
- Defined in:
- lib/applitools/eyes_logger.rb
Defined Under Namespace
Classes: NullLogger
Constant Summary collapse
- MANDATORY_METHODS =
[:debug, :info, :warn, :error, :fatal, :close].freeze
- OPTIONAL_METHODS =
[].freeze
Class Method Summary collapse
-
.add_thread_id_to_log_handler!(log_handler) ⇒ Object
noinspection SpellCheckingInspection.
Instance Method Summary collapse
Class Method Details
.add_thread_id_to_log_handler!(log_handler) ⇒ Object
noinspection SpellCheckingInspection
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/applitools/eyes_logger.rb', line 16 def self.add_thread_id_to_log_handler!(log_handler) original_formatter = Logger::Formatter.new log_handler.formatter = proc do |severity, datetime, progname, msg| updated_progname = "#{progname} (#{Thread.current.object_id})" original_formatter.call( severity, datetime, updated_progname, msg.respond_to?(:dump) && msg.dump || msg.respond_to?(:to_s) && msg.to_s || msg ) end end |
Instance Method Details
#log_handler ⇒ Object
43 44 45 |
# File 'lib/applitools/eyes_logger.rb', line 43 def log_handler @log_handler end |
#log_handler=(log_handler) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/applitools/eyes_logger.rb', line 36 def log_handler=(log_handler) raise Applitools::EyesError.new('log_handler must implement Logger!') unless valid?(log_handler) Applitools::EyesLogger.add_thread_id_to_log_handler! log_handler @log_handler = log_handler end |
#logger ⇒ Object
47 48 49 |
# File 'lib/applitools/eyes_logger.rb', line 47 def logger self end |