Module: Awetestlib::Logging
- Included in:
- Regression::Runner
- Defined in:
- lib/awetestlib/logging.rb
Overview
Logging and reporting.
Class Method Summary collapse
- .included(mod) ⇒ Object deprecated Deprecated.
Instance Method Summary collapse
- #debug_to_log(message, lnbr = nil, dbg = false) (also: #debug_tolog)
- #debug_to_report(message, dbg = false)
- #error_to_log(message, lnbr = nil) (also: #error_tolog)
- #failed_to_log(message, lnbr = nil, dbg = false, exception = nil) (also: #validate_failed_tolog, #validate_failed_to_log, #failed_tolog, #fail_tolog, #fail_to_log)
- #fatal_to_log(message, lnbr = nil, dbg = false, exception = nil) (also: #fatal_tolog)
- #info_to_log(message, lnbr = nil) (also: #message_tolog, #message_to_log, #info_tolog)
-
#mark_test_level(message = '', lvl = nil, desc = '', dbg = nil)
(also: #mark_testlevel)
Write a status message to the log and report indicating location or activity in the script.
- #message_to_report(message, dbg = false)
- #passed_to_log(message, lnbr = nil, dbg = false) (also: #validate_passed_tolog, #validate_passed_to_log, #passed_tolog, #pass_tolog, #pass_to_log)
Class Method Details
.included(mod) ⇒ Object
6 7 8 |
# File 'lib/awetestlib/logging.rb', line 6 def self.included(mod) # puts "RegressionSupport::Logging extended by #{mod}" end |
Instance Method Details
#debug_to_log(message, lnbr = nil, dbg = false) Also known as: debug_tolog
This method returns an undefined value.
151 152 153 154 |
# File 'lib/awetestlib/logging.rb', line 151 def debug_to_log(, lnbr = nil, dbg = false) << "\n#{get_debug_list}" if dbg or @debug_calls # and not @debug_calls_fail_only) (DEBUG, "#{}", nil, lnbr) end |
#debug_to_report(message, dbg = false)
This method returns an undefined value.
220 221 222 |
# File 'lib/awetestlib/logging.rb', line 220 def debug_to_report(, dbg = false) mark_testlevel("(DEBUG): ", 0, "#{}", dbg) end |
#error_to_log(message, lnbr = nil) Also known as: error_tolog
Do not use for failed validations. Use only for serious error conditions.
This method returns an undefined value.
161 162 163 |
# File 'lib/awetestlib/logging.rb', line 161 def error_to_log(, lnbr = nil) (ERROR, , nil, lnbr) end |
#failed_to_log(message, lnbr = nil, dbg = false, exception = nil) Also known as: validate_failed_tolog, validate_failed_to_log, failed_tolog, fail_tolog, fail_to_log
This method returns an undefined value.
185 186 187 188 189 190 191 |
# File 'lib/awetestlib/logging.rb', line 185 def failed_to_log(, lnbr = nil, dbg = false, exception = nil) << " \n#{get_debug_list}" if dbg.to_s == 'true' or @debug_calls or @debug_calls_fail_only @my_failed_count += 1 if @my_failed_count parse_error_references(, true) @report_class.add_to_report("#{}" + " [#{get_caller(lnbr)}]", "FAILED") unless Awetestlib::Runner.nil? (WARN, "#{}", FAIL, lnbr, nil, exception) end |
#fatal_to_log(message, lnbr = nil, dbg = false, exception = nil) Also known as: fatal_tolog
This method returns an undefined value.
201 202 203 204 205 206 207 208 |
# File 'lib/awetestlib/logging.rb', line 201 def fatal_to_log(, lnbr = nil, dbg = false, exception = nil) << " \n#{get_debug_list}" if dbg.to_s == 'true' or (@debug_calls and not @debug_calls_fail_only) @my_failed_count += 1 if @my_failed_count parse_error_references(, true) @report_class.add_to_report("#{}" + " [#{get_caller(lnbr)}]", "FAILED") unless Awetestlib::Runner.nil? debug_to_report("#{__method__}:\n#{dump_caller(lnbr)}") (FATAL, "#{} (#{lnbr})", FAIL, lnbr, nil, exception) end |
#info_to_log(message, lnbr = nil) Also known as: message_tolog, message_to_log, info_tolog
This method returns an undefined value.
141 142 143 |
# File 'lib/awetestlib/logging.rb', line 141 def info_to_log(, lnbr = nil) (INFO, , 0, lnbr) end |
#mark_test_level(message = '', lvl = nil, desc = '', dbg = nil) Also known as: mark_testlevel
This method returns an undefined value.
Write a status message to the log and report indicating location or activity in the script. mark_test_level automatically determines the call hierarchy level of the calling method within the script and project utility methods. The top level method of the script is always level 1. The method also prefixes the calling method name (titleized) to the message to be placed in the log. calling method name. attached. Any other integer is ignored in favor of the calculated level
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/awetestlib/logging.rb', line 118 def mark_test_level( = '', lvl = nil, desc = '', dbg = nil) call_arr = get_call_array() #debug_to_log("#{call_arr.to_yaml}") strg = '' call_script, call_line, call_meth = parse_caller(call_arr[1]) if not lvl or lvl > 1 lvl, list = get_test_level strg << "#{call_meth.titleize}" end strg << " #{}" if .length > 0 strg << " (#{desc})" if desc.length > 0 strg << " [#{call_line}]" strg << "\n#{list.to_yaml}" if dbg or @debug_calls @report_class.add_to_report(strg, " ", lvl || 1) unless Awetestlib::Runner.nil? (INFO, strg, lvl, nil, 1) rescue failed_to_log("#{__method__}: #{$!}") end |
#message_to_report(message, dbg = false)
This method returns an undefined value.
214 215 216 |
# File 'lib/awetestlib/logging.rb', line 214 def (, dbg = false) mark_testlevel(, 0, '', dbg) end |
#passed_to_log(message, lnbr = nil, dbg = false) Also known as: validate_passed_tolog, validate_passed_to_log, passed_tolog, pass_tolog, pass_to_log
This method returns an undefined value.
169 170 171 172 173 174 175 |
# File 'lib/awetestlib/logging.rb', line 169 def passed_to_log(, lnbr = nil, dbg = false) << " \n#{get_debug_list}" if dbg or @debug_calls # and not @debug_calls_fail_only) @my_passed_count += 1 if @my_passed_count parse_error_references() @report_class.add_to_report(, "PASSED") unless Awetestlib::Runner.nil? (INFO, "#{}", PASS, lnbr) end |