Module: Calabash::Cucumber::Logging
- Included in:
- Calabash::Cucumber, Core, Device, EnvironmentHelpers, KeyboardHelpers, Launcher, Operations, PlaybackHelpers, RotationHelpers, SimulatorLauncher, StatusBarHelpers, UIA, WaitHelpers
- Defined in:
- lib/calabash-cucumber/utils/logging.rb
Overview
internal logging methods for calabash-ios gem
Constant Summary collapse
- CALABASH_NO_DEPRECATION =
controls printing of deprecation warnings
to inhibit deprecation message set this to ‘1’
inhibiting deprecation messages is not recommend
ENV['CALABASH_NO_DEPRECATION'] || '0'
Instance Method Summary collapse
-
#_deprecated(version, msg, type) ⇒ Object
prints a deprecated message that includes the line number.
-
#calabash_info(msg) ⇒ Object
prints a green info message.
-
#calabash_warn(msg) ⇒ Object
prints a blue/cyan warning message.
-
#debug_logging? ⇒ Boolean
controls whether or not calabash logs debug information.
-
#full_console_logging? ⇒ Boolean
controls the the kind of information calabash logs.
-
#no_deprecation_warnings? ⇒ Boolean
returns
true
if theCALABASH_NO_DEPRECATION
variable is set to1
.
Instance Method Details
#_deprecated(version, msg, type) ⇒ Object
prints a deprecated message that includes the line number
if ENV == ‘1’ then this method is a nop
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 67 def _deprecated(version, msg, type) allowed = [:pending, :warn] unless allowed.include?(type) raise "type '#{type}' must be on of '#{allowed}'" end unless no_deprecation_warnings? if RUBY_VERSION < '2.0' stack = Kernel.caller()[1..6].join("\n") else stack = Kernel.caller(0, 6)[1..-1].join("\n") end msg = "deprecated '#{version}' - '#{msg}'\n#{stack}" if type.eql?(:pending) pending(msg) else begin warn "\033[34m\nWARN: #{msg}\033[0m" rescue warn "\nWARN: #{msg}" end end end end |
#calabash_info(msg) ⇒ Object
prints a green info message
38 39 40 41 42 43 44 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 38 def calabash_info(msg) begin puts "\033[32m\nINFO: #{msg}\033[0m" rescue puts "\nINFO: #{msg}" end end |
#calabash_warn(msg) ⇒ Object
prints a blue/cyan warning message
28 29 30 31 32 33 34 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 28 def calabash_warn(msg) begin warn "\033[34m\nWARN: #{msg}\033[0m" rescue warn "\nWARN: #{msg}" end end |
#debug_logging? ⇒ Boolean
controls whether or not calabash logs debug information
22 23 24 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 22 def debug_logging? ENV['DEBUG'] == '1' end |
#full_console_logging? ⇒ Boolean
controls the the kind of information calabash logs
this is considered one level above debug logging - maybe we should call the info log level.
15 16 17 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 15 def full_console_logging? ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' end |
#no_deprecation_warnings? ⇒ Boolean
returns true
if the CALABASH_NO_DEPRECATION
variable is set to 1
55 56 57 |
# File 'lib/calabash-cucumber/utils/logging.rb', line 55 def no_deprecation_warnings? ENV['CALABASH_NO_DEPRECATION'] == '1' end |