How to use debug method of Howitzer Package

Best Howitzer_ruby code snippet using Howitzer.debug


Source:log_spec.rb Github


Full Screen

...7 let(:other_log) { described_class.instance }8 it { be_a_kind_of(described_class) }9 it { equal(other_log) }10 end11 context '.debug' do12 it do13 expect(described_class.instance).to receive(:debug).with('Foo')14 described_class.debug('Foo')15 end16 end17 context '.info' do18 it do19 expect(described_class.instance).to receive(:info).with('Foo')20'Foo')21 end22 end23 context '.warn' do24 it do25 expect(described_class.instance).to receive(:warn).with('Foo')26 described_class.warn('Foo')27 end28 end29 context '.fatal' do30 it do31 expect(described_class.instance).to receive(:fatal).with('Foo')32 described_class.fatal('Foo')33 end34 end35 context '.error' do36 it do37 expect(described_class.instance).to receive(:error).with('Foo')38 described_class.error('Foo')39 end40 end41 context '.print_feature_name' do42 it do43 expect(described_class.instance).to receive(:print_feature_name).with('Foo')44 described_class.print_feature_name('Foo')45 end46 end47 context '.settings_as_formatted_text' do48 it do49 expect(described_class.instance).to receive(:settings_as_formatted_text).with(no_args)50 described_class.settings_as_formatted_text51 end52 end53 context '.print_scenario_name' do54 it do55 expect(described_class.instance).to receive(:print_scenario_name).with('Foo')56 described_class.print_scenario_name('Foo')57 end58 end59 describe '#debug' do60 it do61 expect(described_class.instance.instance_variable_get(:@logger)).to receive(:debug).with(:foo)62 described_class.instance.debug :foo63 end64 end65 describe '#info' do66 it do67 expect(described_class.instance.instance_variable_get(:@logger)).to receive(:info).with(:foo)68 :foo69 end70 end71 describe '#warn' do72 it do73 expect(described_class.instance.instance_variable_get(:@logger)).to receive(:warn).with(:foo)74 described_class.instance.warn :foo75 end76 end...

Full Screen

Full Screen


Source:log.rb Github


Full Screen

...7 include Singleton8 include Log4r9 class << self10 # Delegates all public instance methods to the class11 delegate :debug, :info, :warn, :fatal, :error, :print_feature_name,12 :settings_as_formatted_text, :print_scenario_name, to: :instance13 end14 # Outputs debug message if Howitzer.debug_mode == true15 # @param msg [String] a message16 def debug(msg)17 @logger.debug(msg)18 end19 # Outputs info message20 # @param msg [String] a message21 def info(msg)22 end24 # Outputs warn message25 # @param msg [String] a message26 def warn(msg)27 @logger.warn(msg)28 end29 # Outputs error message30 # @param msg [String] a message31 def error(msg)32 @logger.error(msg)33 end34 # Outputs fatal message35 # @param msg [String] a message36 def fatal(msg)37 @logger.fatal(msg)38 end39 # Outputs a feature name into the log with INFO severity40 # @param text [String] a feature name41 def print_feature_name(text)42 log_without_formatting { info "*** Feature: #{text.upcase} ***" }43 end44 # Outputs formatted howitzer settings45 def settings_as_formatted_text46 log_without_formatting { info ::SexySettings::Base.instance.as_formatted_text }47 end48 # Outputs a scenario name into log with INFO severity49 # @param text [String] a scenario name50 def print_scenario_name(text)51 log_without_formatting { info " => Scenario: #{text}" }52 end53 private54 def initialize55 @logger ='ruby_log')56 @logger.add(console_log)57 @logger.add(error_log)58 self.base_formatter = default_formatter59 Logger['ruby_log'].level = Howitzer.debug_mode ? ALL : INFO60 Logger['ruby_log'].trace = true61 end62 # :nocov:63 def log_without_formatting64 self.base_formatter = blank_formatter65 yield66 self.base_formatter = default_formatter67 end68 # :nocov:69 def console_log70 { |o| o.only_at(INFO, DEBUG, WARN) }71 end72 def error_log73, 'level' => ERROR)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?