Module: DebugLogging::InstanceLogger
- Defined in:
- lib/debug_logging/instance_logger.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#i_logged(*methods_to_log, **options) ⇒ Object
NOTE: These options can also be passed in / hidden in a last hash of *args NOTE: They can also be passed in discretely for each method, by passing *args as an array of arrays.
Class Method Details
.extended(base) ⇒ Object
4 5 6 |
# File 'lib/debug_logging/instance_logger.rb', line 4 def extended(base) base.include(LambDartable::Log) end |
Instance Method Details
#i_logged(*methods_to_log, **options) ⇒ Object
NOTE: These options can also be passed in / hidden in a last hash of *args NOTE: They can also be passed in discretely for each method, by passing *args as an array of arrays
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/debug_logging/instance_logger.rb', line 30 def i_logged(*methods_to_log, **) methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config( method_names: methods_to_log, payload: nil, config: nil, options: ) instance_method_modules = Array(methods_to_log).map do |decorated_method| DebugLogging::InstanceLoggerModulizer.to_mod( methods_to_log: Array(decorated_method), payload: payload, config: config_opts ) end wrapped_in_logs = Module.new do singleton_class.send(:define_method, :included) do |host_class| instance_method_modules.each do |mod| host_class.prepend(mod) end end end send(:include, wrapped_in_logs) end |