Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/debugtrace/config.rb
Overview
Retains the contents defined in debugtrace.yml.
Instance Attribute Summary collapse
-
#bytes_count_in_line ⇒ Object
Returns the value of attribute bytes_count_in_line.
-
#circular_reference_string ⇒ Object
Returns the value of attribute circular_reference_string.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#data_indent_string ⇒ Object
Returns the value of attribute data_indent_string.
-
#data_output_width ⇒ Object
Returns the value of attribute data_output_width.
-
#enter_format ⇒ Object
Returns the value of attribute enter_format.
-
#indent_string ⇒ Object
Returns the value of attribute indent_string.
-
#key_value_separator ⇒ Object
Returns the value of attribute key_value_separator.
-
#leave_format ⇒ Object
Returns the value of attribute leave_format.
-
#length_format ⇒ Object
Returns the value of attribute length_format.
-
#limit_string ⇒ Object
Returns the value of attribute limit_string.
-
#log_datetime_format ⇒ Object
Returns the value of attribute log_datetime_format.
-
#log_path ⇒ Object
Returns the value of attribute log_path.
-
#logger_name ⇒ Object
Returns the value of attribute logger_name.
-
#maximum_indents ⇒ Object
Returns the value of attribute maximum_indents.
-
#minimum_output_length ⇒ Object
Returns the value of attribute minimum_output_length.
-
#minimum_output_size ⇒ Object
Returns the value of attribute minimum_output_size.
-
#output_length_limit ⇒ Object
Returns the value of attribute output_length_limit.
-
#output_size_limit ⇒ Object
Returns the value of attribute output_size_limit.
-
#print_suffix_format ⇒ Object
Returns the value of attribute print_suffix_format.
-
#reflection_limit ⇒ Object
Returns the value of attribute reflection_limit.
-
#rubylogger_format ⇒ Object
Returns the value of attribute rubylogger_format.
-
#size_format ⇒ Object
Returns the value of attribute size_format.
-
#thread_boundary_format ⇒ Object
Returns the value of attribute thread_boundary_format.
-
#varname_value_separator ⇒ Object
Returns the value of attribute varname_value_separator.
Instance Method Summary collapse
-
#enabled? ⇒ TrueClass, FalseClass
Returns true if logging is enabled, false otherwise.
-
#initialize(config_path) ⇒ Config
constructor
Initializes with a yml file in the config_path.
Constructor Details
#initialize(config_path) ⇒ Config
Initializes with a yml file in the config_path.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/debugtrace/config.rb', line 39 def initialize(config_path) @config_path = config_path if File.exist?(@config_path) @config = YAML.load_file(@config_path) else @config_path = '<No config file>' @config = nil end @logger_name = get_value 'logger' , 'stderr' @log_path = get_value 'log_path' , 'debugtrace.log' @rubylogger_format = get_value 'rubylogger_format' , "%2$s %1$s %4$s\n" @log_datetime_format = get_value 'log_datetime_format' , '%Y-%m-%d %H:%M:%S.%L%:z' @enabled = get_value 'enabled' , true @enter_format = get_value 'enter_format' , 'Enter %1$s (%2$s:%3$d) <- %4$s (%5$s:%6$d)' @leave_format = get_value 'leave_format' , 'Leave %1$s (%2$s:%3$d) duration: %4$.3f ms' @thread_boundary_format = get_value 'thread_boundary_format' , '______________________________ %1$s #%2$d ______________________________' @maximum_indents = get_value 'maximum_indents' , 32 @indent_string = get_value 'indent_string' , '| ' @data_indent_string = get_value 'data_indent_string' , ' ' @limit_string = get_value 'limit_string' , '...' @circular_reference_string = get_value 'circular_reference_string', '*** Circular Reference ***' @varname_value_separator = get_value 'varname_value_separator' , ' = ' @key_value_separator = get_value 'key_value_separator' , ': ' @print_suffix_format = get_value 'print_suffix_format' , ' (%2$s:%3$d)' @size_format = get_value 'size_format' , '(size:%d)' @minimum_output_size = get_value 'minimum_output_size' , 256 @length_format = get_value 'length_format' , '(length:%d)' @minimum_output_length = get_value 'minimum_output_length' , 256 @data_output_width = get_value 'data_output_width' , 70 @bytes_count_in_line = get_value 'bytes_count_in_line' , 16 @output_size_limit = get_value 'output_size_limit' , 128 @output_length_limit = get_value 'output_length_limit' , 256 @reflection_limit = get_value 'reflection_limit' , 4 end |
Instance Attribute Details
#bytes_count_in_line ⇒ Object
Returns the value of attribute bytes_count_in_line.
31 32 33 |
# File 'lib/debugtrace/config.rb', line 31 def bytes_count_in_line @bytes_count_in_line end |
#circular_reference_string ⇒ Object
Returns the value of attribute circular_reference_string.
22 23 24 |
# File 'lib/debugtrace/config.rb', line 22 def circular_reference_string @circular_reference_string end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/debugtrace/config.rb', line 10 def config @config end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
9 10 11 |
# File 'lib/debugtrace/config.rb', line 9 def config_path @config_path end |
#data_indent_string ⇒ Object
Returns the value of attribute data_indent_string.
20 21 22 |
# File 'lib/debugtrace/config.rb', line 20 def data_indent_string @data_indent_string end |
#data_output_width ⇒ Object
Returns the value of attribute data_output_width.
30 31 32 |
# File 'lib/debugtrace/config.rb', line 30 def data_output_width @data_output_width end |
#enter_format ⇒ Object
Returns the value of attribute enter_format.
15 16 17 |
# File 'lib/debugtrace/config.rb', line 15 def enter_format @enter_format end |
#indent_string ⇒ Object
Returns the value of attribute indent_string.
19 20 21 |
# File 'lib/debugtrace/config.rb', line 19 def indent_string @indent_string end |
#key_value_separator ⇒ Object
Returns the value of attribute key_value_separator.
24 25 26 |
# File 'lib/debugtrace/config.rb', line 24 def key_value_separator @key_value_separator end |
#leave_format ⇒ Object
Returns the value of attribute leave_format.
16 17 18 |
# File 'lib/debugtrace/config.rb', line 16 def leave_format @leave_format end |
#length_format ⇒ Object
Returns the value of attribute length_format.
28 29 30 |
# File 'lib/debugtrace/config.rb', line 28 def length_format @length_format end |
#limit_string ⇒ Object
Returns the value of attribute limit_string.
21 22 23 |
# File 'lib/debugtrace/config.rb', line 21 def limit_string @limit_string end |
#log_datetime_format ⇒ Object
Returns the value of attribute log_datetime_format.
14 15 16 |
# File 'lib/debugtrace/config.rb', line 14 def log_datetime_format @log_datetime_format end |
#log_path ⇒ Object
Returns the value of attribute log_path.
12 13 14 |
# File 'lib/debugtrace/config.rb', line 12 def log_path @log_path end |
#logger_name ⇒ Object
Returns the value of attribute logger_name.
11 12 13 |
# File 'lib/debugtrace/config.rb', line 11 def logger_name @logger_name end |
#maximum_indents ⇒ Object
Returns the value of attribute maximum_indents.
18 19 20 |
# File 'lib/debugtrace/config.rb', line 18 def maximum_indents @maximum_indents end |
#minimum_output_length ⇒ Object
Returns the value of attribute minimum_output_length.
29 30 31 |
# File 'lib/debugtrace/config.rb', line 29 def minimum_output_length @minimum_output_length end |
#minimum_output_size ⇒ Object
Returns the value of attribute minimum_output_size.
27 28 29 |
# File 'lib/debugtrace/config.rb', line 27 def minimum_output_size @minimum_output_size end |
#output_length_limit ⇒ Object
Returns the value of attribute output_length_limit.
33 34 35 |
# File 'lib/debugtrace/config.rb', line 33 def output_length_limit @output_length_limit end |
#output_size_limit ⇒ Object
Returns the value of attribute output_size_limit.
32 33 34 |
# File 'lib/debugtrace/config.rb', line 32 def output_size_limit @output_size_limit end |
#print_suffix_format ⇒ Object
Returns the value of attribute print_suffix_format.
25 26 27 |
# File 'lib/debugtrace/config.rb', line 25 def print_suffix_format @print_suffix_format end |
#reflection_limit ⇒ Object
Returns the value of attribute reflection_limit.
34 35 36 |
# File 'lib/debugtrace/config.rb', line 34 def reflection_limit @reflection_limit end |
#rubylogger_format ⇒ Object
Returns the value of attribute rubylogger_format.
13 14 15 |
# File 'lib/debugtrace/config.rb', line 13 def rubylogger_format @rubylogger_format end |
#size_format ⇒ Object
Returns the value of attribute size_format.
26 27 28 |
# File 'lib/debugtrace/config.rb', line 26 def size_format @size_format end |
#thread_boundary_format ⇒ Object
Returns the value of attribute thread_boundary_format.
17 18 19 |
# File 'lib/debugtrace/config.rb', line 17 def thread_boundary_format @thread_boundary_format end |
#varname_value_separator ⇒ Object
Returns the value of attribute varname_value_separator.
23 24 25 |
# File 'lib/debugtrace/config.rb', line 23 def varname_value_separator @varname_value_separator end |
Instance Method Details
#enabled? ⇒ TrueClass, FalseClass
Returns true if logging is enabled, false otherwise.
77 78 79 |
# File 'lib/debugtrace/config.rb', line 77 def enabled? return @enabled end |