Reference documentation and code samples for the google-logging-utils class Google::Logging::SourceLocation.
An object representing a source location as used by Google Logging.
Inherits
- Object
Methods
.for_caller
def self.for_caller(locations: nil, extra_depth: 0, omit_files: nil) -> SourceLocation, nil
Returns a SourceLocation corresponding to the caller.
This basically walks the stack trace backwards until it finds the
first entry not in the google/logging/message.rb
source file or in
any of the other files optionally listed.
Parameters
- locations (Array<Thread::Backtrace::Location>) (defaults to: nil) — The caller stack to search. Optional; defaults to the current stack.
- extra_depth (Integer) (defaults to: 0) — Optional extra steps backwards to walk. Defaults to 0.
- omit_files (Array<String,Regexp>) (defaults to: nil) — File paths to omit.
Returns
- (SourceLocation, nil) — The SourceLocation, or nil if none found.
#file
def file() -> String
Returns
- (String) — Path to the source file.
#function
def function() -> String
Returns
- (String) — Name of the calling function.
#initialize
def initialize(file:, line:, function:) -> SourceLocation
Low-level constructor.
Parameters
- file (String) — Path to the source file.
- line (String) — Line number as a string.
- function (String) — Name of the calling function.
Returns
- (SourceLocation) — a new instance of SourceLocation
#line
def line() -> String
Returns
- (String) — Line number as a string.