class Google::Logging::SourceLocation
def self.for_caller locations: nil, extra_depth: 0, omit_files: nil
-
(SourceLocation, nil)
- The SourceLocation, or nil if none found.
Parameters:
-
omit_files
(Array
) -- File paths to omit. -
extra_depth
(Integer
) -- Optional extra steps backwards to walk. -
locations
(Array
) -- The caller stack
def self.for_caller locations: nil, extra_depth: 0, omit_files: nil in_file = true omit_files = [__FILE__] + Array(omit_files) (locations || self.caller_locations).each do |loc| if in_file next if omit_files.any? { |pat| pat === loc.absolute_path } in_file = false end extra_depth -= 1 next unless extra_depth.negative? return new file: loc.path, line: loc.lineno.to_s, function: loc.base_label end nil end