Class: DebugLogging::Configuration
- Inherits:
-
Object
- Object
- DebugLogging::Configuration
- Defined in:
- lib/debug_logging/configuration.rb
Constant Summary collapse
- DEFAULT_ELLIPSIS =
" ✂️ …".freeze
Instance Attribute Summary collapse
-
#add_invocation_id ⇒ Object
(also: #debug_add_invocation_id)
Returns the value of attribute add_invocation_id.
-
#args_max_length ⇒ Object
(also: #debug_args_max_length)
Returns the value of attribute args_max_length.
-
#class_benchmarks ⇒ Object
(also: #debug_class_benchmarks)
Returns the value of attribute class_benchmarks.
-
#colorized_chain_for_class ⇒ Object
(also: #debug_colorized_chain_for_class)
Returns the value of attribute colorized_chain_for_class.
-
#colorized_chain_for_method ⇒ Object
(also: #debug_colorized_chain_for_method)
Returns the value of attribute colorized_chain_for_method.
-
#ellipsis ⇒ Object
(also: #debug_ellipsis)
Returns the value of attribute ellipsis.
-
#instance_benchmarks ⇒ Object
(also: #debug_instance_benchmarks)
Returns the value of attribute instance_benchmarks.
-
#last_hash_max_length ⇒ Object
(also: #debug_last_hash_max_length)
Returns the value of attribute last_hash_max_length.
-
#last_hash_to_s_proc ⇒ Object
(also: #debug_last_hash_to_s_proc)
Returns the value of attribute last_hash_to_s_proc.
-
#log_level ⇒ Object
(also: #debug_log_level)
Returns the value of attribute log_level.
-
#logger ⇒ Object
(also: #debug_logger)
Returns the value of attribute logger.
-
#multiple_last_hashes ⇒ Object
(also: #debug_multiple_last_hashes)
Returns the value of attribute multiple_last_hashes.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_hash ⇒ Object
Constructor Details
#initialize(**options) ⇒ Configuration
Returns a new instance of Configuration.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/debug_logging/configuration.rb', line 46 def initialize(**) @logger = .key?(:logger) ? [:logger] : Logger.new(STDOUT) @log_level = .key?(:log_level) ? [:log_level] : :debug @multiple_last_hashes = .key?(:multiple_last_hashes) ? [:multiple_last_hashes] : false @last_hash_to_s_proc = .key?(:last_hash_to_s_proc) ? [:last_hash_to_s_proc] : nil @last_hash_max_length = .key?(:last_hash_max_length) ? [:last_hash_max_length] : 1_000 @args_max_length = .key?(:args_max_length) ? [:args_max_length] : 1_000 @instance_benchmarks = .key?(:instance_benchmarks) ? [:instance_benchmarks] : false @class_benchmarks = .key?(:class_benchmarks) ? [:class_benchmarks] : false @colorized_chain_for_method = .key?(:colorized_chain_for_method) ? [:colorized_chain_for_method] : false @colorized_chain_for_class = .key?(:colorized_chain_for_class) ? [:colorized_chain_for_class] : false @add_invocation_id = .key?(:add_invocation_id) ? [:add_invocation_id] : true @ellipsis = .key?(:ellipsis) ? [:ellipsis] : DEFAULT_ELLIPSIS end |
Instance Attribute Details
#add_invocation_id ⇒ Object Also known as: debug_add_invocation_id
Returns the value of attribute add_invocation_id.
14 15 16 |
# File 'lib/debug_logging/configuration.rb', line 14 def add_invocation_id @add_invocation_id end |
#args_max_length ⇒ Object Also known as: debug_args_max_length
Returns the value of attribute args_max_length.
9 10 11 |
# File 'lib/debug_logging/configuration.rb', line 9 def args_max_length @args_max_length end |
#class_benchmarks ⇒ Object Also known as: debug_class_benchmarks
Returns the value of attribute class_benchmarks.
11 12 13 |
# File 'lib/debug_logging/configuration.rb', line 11 def class_benchmarks @class_benchmarks end |
#colorized_chain_for_class ⇒ Object Also known as: debug_colorized_chain_for_class
Returns the value of attribute colorized_chain_for_class.
13 14 15 |
# File 'lib/debug_logging/configuration.rb', line 13 def colorized_chain_for_class @colorized_chain_for_class end |
#colorized_chain_for_method ⇒ Object Also known as: debug_colorized_chain_for_method
Returns the value of attribute colorized_chain_for_method.
12 13 14 |
# File 'lib/debug_logging/configuration.rb', line 12 def colorized_chain_for_method @colorized_chain_for_method end |
#ellipsis ⇒ Object Also known as: debug_ellipsis
Returns the value of attribute ellipsis.
15 16 17 |
# File 'lib/debug_logging/configuration.rb', line 15 def ellipsis @ellipsis end |
#instance_benchmarks ⇒ Object Also known as: debug_instance_benchmarks
Returns the value of attribute instance_benchmarks.
10 11 12 |
# File 'lib/debug_logging/configuration.rb', line 10 def instance_benchmarks @instance_benchmarks end |
#last_hash_max_length ⇒ Object Also known as: debug_last_hash_max_length
Returns the value of attribute last_hash_max_length.
8 9 10 |
# File 'lib/debug_logging/configuration.rb', line 8 def last_hash_max_length @last_hash_max_length end |
#last_hash_to_s_proc ⇒ Object Also known as: debug_last_hash_to_s_proc
Returns the value of attribute last_hash_to_s_proc.
7 8 9 |
# File 'lib/debug_logging/configuration.rb', line 7 def last_hash_to_s_proc @last_hash_to_s_proc end |
#log_level ⇒ Object Also known as: debug_log_level
Returns the value of attribute log_level.
5 6 7 |
# File 'lib/debug_logging/configuration.rb', line 5 def log_level @log_level end |
#logger ⇒ Object Also known as: debug_logger
Returns the value of attribute logger.
4 5 6 |
# File 'lib/debug_logging/configuration.rb', line 4 def logger @logger end |
#multiple_last_hashes ⇒ Object Also known as: debug_multiple_last_hashes
Returns the value of attribute multiple_last_hashes.
6 7 8 |
# File 'lib/debug_logging/configuration.rb', line 6 def multiple_last_hashes @multiple_last_hashes end |
Instance Method Details
#to_hash ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/debug_logging/configuration.rb', line 68 def to_hash { logger: logger, log_level: log_level, multiple_last_hashes: multiple_last_hashes, last_hash_to_s_proc: last_hash_to_s_proc, last_hash_max_length: last_hash_max_length, args_max_length: args_max_length, instance_benchmarks: instance_benchmarks, class_benchmarks: class_benchmarks, colorized_chain_for_method: colorized_chain_for_method, colorized_chain_for_class: colorized_chain_for_class, add_invocation_id: add_invocation_id, ellipsis: ellipsis } end |