Module: DroidAdbs::Logcat

Defined in:
lib/droid_adbs/commons/logcat.rb

Class Method Summary collapse

Class Method Details

.clearString

Returns Empty string if the command is succeeded.

Returns:

  • (String)

    Empty string if the command is succeeded



5
6
7
8
9
# File 'lib/droid_adbs/commons/logcat.rb', line 5

def clear
  result = `#{::DroidAdbs.shell} logcat -c`
  puts result unless result.empty?
  result
end

.filter_fatal_exception(logcat) ⇒ String|nil

Return a fatal exception

Parameters:

  • logcat (String)

Returns:

  • (String|nil)

    Return a fatal exception



33
34
35
# File 'lib/droid_adbs/commons/logcat.rb', line 33

def filter_fatal_exception(logcat)
  do_filter_fatal_exceptions(logcat).first
end

.filter_fatal_exceptions(logcat) ⇒ Array

Return a fatal exception

Parameters:

  • logcat (String)

Returns:

  • (Array)

    Return a fatal exception



39
40
41
# File 'lib/droid_adbs/commons/logcat.rb', line 39

def filter_fatal_exceptions(logcat)
  do_filter_fatal_exceptions(logcat)
end

.get(log_level: :w) ⇒ String

Returns Message from adb command.

Parameters:

  • log_level (Symbol) (defaults to: :w)

    Log level. Default is warning(:w).

Returns:

  • (String)

    Message from adb command



13
14
15
16
# File 'lib/droid_adbs/commons/logcat.rb', line 13

def get(log_level: :w)
  level = validate_log_level log_level
  `#{::DroidAdbs.shell} logcat -d *:#{level}`.strip
end

.get_sigsegvString

Returns Message from adb command.

Returns:

  • (String)

    Message from adb command



27
28
29
# File 'lib/droid_adbs/commons/logcat.rb', line 27

def get_sigsegv
  `#{::DroidAdbs.shell} logcat -d *:W | grep "SIGSEGV"`.strip
end

.save_logs_in(file_path:, log_level: :w) ⇒ String

Returns Message from adb command.

Parameters:

  • file_path (String)

    File path to save logcat.

  • log_level (Symbol) (defaults to: :w)

    Log level. Default is warning(:w).

Returns:

  • (String)

    Message from adb command



21
22
23
24
# File 'lib/droid_adbs/commons/logcat.rb', line 21

def save_logs_in(file_path:, log_level: :w)
  level = validate_log_level log_level
  `#{::DroidAdbs.shell} logcat -d *:#{level} -f #{file_path}`.strip
end