Module: DebugLogging
- Defined in:
- lib/debug_logging.rb,
lib/debug_logging/util.rb,
lib/debug_logging/hooks.rb,
lib/debug_logging/errors.rb,
lib/debug_logging/version.rb,
lib/debug_logging/finalize.rb,
lib/debug_logging/class_logger.rb,
lib/debug_logging/configuration.rb,
lib/debug_logging/class_notifier.rb,
lib/debug_logging/log_subscriber.rb,
lib/debug_logging/instance_logger.rb,
lib/debug_logging/argument_printer.rb,
lib/debug_logging/instance_notifier.rb,
lib/debug_logging/instance_logger_modulizer.rb,
lib/debug_logging/instance_notifier_modulizer.rb
Overview
Defined Under Namespace
Modules: ArgumentPrinter, ClassLogger, ClassNotifier, Finalize, Hooks, InstanceLoggerModulizer, InstanceNotifierModulizer, Util
Classes: Configuration, Error, InstanceLogger, InstanceNotifier, LogSubscriber, NoBlockGiven, TimeoutError
Constant Summary
collapse
- VERSION =
'3.1.4'
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.debug_logging_configuration ⇒ Object
Returns the value of attribute debug_logging_configuration.
112
113
114
|
# File 'lib/debug_logging.rb', line 112
def debug_logging_configuration
@debug_logging_configuration
end
|
Class Method Details
.configuration ⇒ Object
For single statement global config in an initializer e.g. DebugLogging.configuration.ellipsis = “…”
95
96
97
|
# File 'lib/debug_logging.rb', line 95
def self.configuration
self.debug_logging_configuration ||= Configuration.new
end
|
For global config in an initializer with a block
100
101
102
|
# File 'lib/debug_logging.rb', line 100
def self.configure
yield(configuration)
end
|
.extended(base) ⇒ Object
65
66
67
68
69
70
71
72
73
|
# File 'lib/debug_logging.rb', line 65
def self.extended(base)
base.send(:extend, ArgumentPrinter)
base.debug_config_reset(Configuration.new(**debug_logging_configuration.to_hash))
base.class_eval do
def base.inherited(subclass)
subclass.debug_config_reset(Configuration.new(**debug_config.to_hash))
end
end
end
|
Instance Method Details
#debug_add_invocation_id ⇒ Object
206
207
208
|
# File 'lib/debug_logging.rb', line 206
def debug_add_invocation_id
@debug_logging_configuration.add_invocation_id
end
|
#debug_add_invocation_id=(add_invocation_id) ⇒ Object
210
211
212
|
# File 'lib/debug_logging.rb', line 210
def debug_add_invocation_id=(add_invocation_id)
@debug_logging_configuration.add_invocation_id = add_invocation_id
end
|
#debug_args_max_length ⇒ Object
166
167
168
|
# File 'lib/debug_logging.rb', line 166
def debug_args_max_length
@debug_logging_configuration.args_max_length
end
|
#debug_args_max_length=(args_max_length) ⇒ Object
170
171
172
|
# File 'lib/debug_logging.rb', line 170
def debug_args_max_length=(args_max_length)
@debug_logging_configuration.args_max_length = args_max_length
end
|
#debug_class_benchmarks ⇒ Object
182
183
184
|
# File 'lib/debug_logging.rb', line 182
def debug_class_benchmarks
@debug_logging_configuration.class_benchmarks
end
|
#debug_class_benchmarks=(class_benchmarks) ⇒ Object
186
187
188
|
# File 'lib/debug_logging.rb', line 186
def debug_class_benchmarks=(class_benchmarks)
@debug_logging_configuration.class_benchmarks = class_benchmarks
end
|
#debug_colorized_chain_for_class ⇒ Object
198
199
200
|
# File 'lib/debug_logging.rb', line 198
def debug_colorized_chain_for_class
@debug_logging_configuration.colorized_chain_for_class
end
|
#debug_colorized_chain_for_class=(colorized_chain_for_class) ⇒ Object
202
203
204
|
# File 'lib/debug_logging.rb', line 202
def debug_colorized_chain_for_class=(colorized_chain_for_class)
@debug_logging_configuration.colorized_chain_for_class = colorized_chain_for_class
end
|
#debug_colorized_chain_for_method ⇒ Object
190
191
192
|
# File 'lib/debug_logging.rb', line 190
def debug_colorized_chain_for_method
@debug_logging_configuration.colorized_chain_for_method
end
|
#debug_colorized_chain_for_method=(colorized_chain_for_method) ⇒ Object
194
195
196
|
# File 'lib/debug_logging.rb', line 194
def debug_colorized_chain_for_method=(colorized_chain_for_method)
@debug_logging_configuration.colorized_chain_for_method = colorized_chain_for_method
end
|
#debug_config ⇒ Object
There are times when the class will need access to the configuration object,
such as to override it per instance method
89
90
91
|
# File 'lib/debug_logging.rb', line 89
def debug_config
@debug_logging_configuration
end
|
#debug_config_reset(config = Configuration.new) ⇒ Object
114
115
116
|
# File 'lib/debug_logging.rb', line 114
def debug_config_reset(config = Configuration.new)
@debug_logging_configuration = config
end
|
#debug_ellipsis ⇒ Object
222
223
224
|
# File 'lib/debug_logging.rb', line 222
def debug_ellipsis
@debug_logging_configuration.ellipsis
end
|
#debug_ellipsis=(ellipsis) ⇒ Object
226
227
228
|
# File 'lib/debug_logging.rb', line 226
def debug_ellipsis=(ellipsis)
@debug_logging_configuration.ellipsis = ellipsis
end
|
#debug_enabled ⇒ Object
118
119
120
|
# File 'lib/debug_logging.rb', line 118
def debug_enabled
@debug_logging_configuration.enabled
end
|
#debug_enabled=(value) ⇒ Object
122
123
124
|
# File 'lib/debug_logging.rb', line 122
def debug_enabled=(value)
@debug_logging_configuration.enabled = value
end
|
#debug_instance_benchmarks ⇒ Object
174
175
176
|
# File 'lib/debug_logging.rb', line 174
def debug_instance_benchmarks
@debug_logging_configuration.instance_benchmarks
end
|
#debug_instance_benchmarks=(instance_benchmarks) ⇒ Object
178
179
180
|
# File 'lib/debug_logging.rb', line 178
def debug_instance_benchmarks=(instance_benchmarks)
@debug_logging_configuration.instance_benchmarks = instance_benchmarks
end
|
#debug_last_hash_max_length ⇒ Object
158
159
160
|
# File 'lib/debug_logging.rb', line 158
def debug_last_hash_max_length
@debug_logging_configuration.last_hash_max_length
end
|
#debug_last_hash_max_length=(last_hash_max_length) ⇒ Object
162
163
164
|
# File 'lib/debug_logging.rb', line 162
def debug_last_hash_max_length=(last_hash_max_length)
@debug_logging_configuration.last_hash_max_length = last_hash_max_length
end
|
#debug_last_hash_to_s_proc ⇒ Object
150
151
152
|
# File 'lib/debug_logging.rb', line 150
def debug_last_hash_to_s_proc
@debug_logging_configuration.last_hash_to_s_proc
end
|
#debug_last_hash_to_s_proc=(last_hash_to_s_proc) ⇒ Object
154
155
156
|
# File 'lib/debug_logging.rb', line 154
def debug_last_hash_to_s_proc=(last_hash_to_s_proc)
@debug_logging_configuration.last_hash_to_s_proc = last_hash_to_s_proc
end
|
#debug_log(message = nil, config_proxy = nil, &block) ⇒ Object
API #### Not used by this gem internally, but provides an external interface for
classes to also use this logging tool directly,
with configured options like benchmarking, colors, or leg level.
79
80
81
82
83
84
85
|
# File 'lib/debug_logging.rb', line 79
def debug_log(message = nil, config_proxy = nil, &block)
config_proxy ||= debug_config
config_proxy.log(message, &block)
end
|
#debug_log_level ⇒ Object
134
135
136
|
# File 'lib/debug_logging.rb', line 134
def debug_log_level
@debug_logging_configuration.log_level
end
|
#debug_log_level=(log_level) ⇒ Object
138
139
140
|
# File 'lib/debug_logging.rb', line 138
def debug_log_level=(log_level)
@debug_logging_configuration.log_level = log_level
end
|
#debug_logger ⇒ Object
126
127
128
|
# File 'lib/debug_logging.rb', line 126
def debug_logger
@debug_logging_configuration.logger
end
|
#debug_logger=(logger) ⇒ Object
130
131
132
|
# File 'lib/debug_logging.rb', line 130
def debug_logger=(logger)
@debug_logging_configuration.logger = logger
end
|
For per-class config with a block
105
106
107
108
|
# File 'lib/debug_logging.rb', line 105
def debug_logging_configure
@debug_logging_configuration ||= Configuration.new
yield(@debug_logging_configuration)
end
|
#debug_mark_scope_exit ⇒ Object
214
215
216
|
# File 'lib/debug_logging.rb', line 214
def debug_mark_scope_exit
@debug_logging_configuration.mark_scope_exit
end
|
#debug_mark_scope_exit=(mark_scope_exit) ⇒ Object
218
219
220
|
# File 'lib/debug_logging.rb', line 218
def debug_mark_scope_exit=(mark_scope_exit)
@debug_logging_configuration.mark_scope_exit = mark_scope_exit
end
|
#debug_multiple_last_hashes ⇒ Object
142
143
144
|
# File 'lib/debug_logging.rb', line 142
def debug_multiple_last_hashes
@debug_logging_configuration.multiple_last_hashes
end
|
#debug_multiple_last_hashes=(multiple_last_hashes) ⇒ Object
146
147
148
|
# File 'lib/debug_logging.rb', line 146
def debug_multiple_last_hashes=(multiple_last_hashes)
@debug_logging_configuration.multiple_last_hashes = multiple_last_hashes
end
|