Module: Eco::Language::AuxiliarLogger
- Included in:
- API::Common::Loaders::Base, API::Common::People::PersonEntry, API::Common::People::PersonEntryAttributeMapper, API::Common::Session::BaseSession, API::Common::Session::FileManager, API::Common::Session::Mailer, API::Common::Session::Mailer::ProviderBase, API::Common::Session::S3Uploader, API::Common::Session::SFTP, API::Session::Batch::Errors, API::Session::Config::BaseConfig, API::UseCases::BaseIO, API::UseCases::GraphQL::Helpers::Base::CaseEnv, API::UseCases::GraphQL::Helpers::Base::ErrorHandling, API::UseCases::GraphQL::Helpers::Location::Command, API::UseCases::OozeSamples::HelpersMigration::Copying, CSV::Split, CSV::Stream, Data::Files::Encoding, Data::Files::InstanceMethods, Data::Hashes::ArrayDiff, Data::Locations::Convert, Data::Locations::NodeBase::TagValidations, Data::Locations::NodeBase::Treeify, Data::Locations::NodeLevel::Cleaner
- Defined in:
- lib/eco/language/auxiliar_logger.rb
Overview
Some modules/classes use logger, but they may not be connected to session. This prevents errors with this.
Instance Attribute Summary collapse
-
#logger ⇒ Object
Provides either an available logger or a basic one.
Instance Method Summary collapse
-
#log(level, &block) ⇒ Object
Shortcut to logger.
Instance Attribute Details
#logger ⇒ Object
Provides either an available logger or a basic one
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/eco/language/auxiliar_logger.rb', line 9 def logger if instance_variable_defined?(:@session) && !@session.nil? @session.logger elsif respond_to?(:session) session.logger elsif Object.const_defined?(:ASSETS) ASSETS.session.logger elsif defined?(super) super else @logger ||= Eco::Language::BasicLogger.new end end |
Instance Method Details
#log(level, &block) ⇒ Object
Shortcut to logger.
24 25 26 27 28 |
# File 'lib/eco/language/auxiliar_logger.rb', line 24 def log(level, &block) return unless logger.respond_to?(:level) logger&.send(level, &block) end |