class Google::Cloud::Logging::Entry::SourceLocation
Additional information about the source code location that produced the log entry.
See also {Google::Cloud::Logging::Entry#source_location}.
Attributes
Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name. Optional.
Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. Optional.
Line within the source file. 1-based; `0` indicates no line number available. Optional.
Public Class Methods
@private New Google::Cloud::Logging::Entry::SourceLocation
from a Google::Cloud::Logging::V2::LogEntrySourceLocation object.
# File lib/google/cloud/logging/entry/source_location.rb, line 74 def self.from_grpc grpc return new if grpc.nil? new.tap do |o| o.file = grpc.file o.line = grpc.line o.function = grpc.function end end
@private Create an empty SourceLocation
object.
# File lib/google/cloud/logging/entry/source_location.rb, line 31 def initialize end
Public Instance Methods
@private Determines if the SourceLocation
has any data.
# File lib/google/cloud/logging/entry/source_location.rb, line 53 def empty? file.nil? && line.nil? && function.nil? end
@private Exports the SourceLocation
to a Google::Cloud::Logging::V2::LogEntrySourceLocation object.
# File lib/google/cloud/logging/entry/source_location.rb, line 62 def to_grpc return nil if empty? Google::Cloud::Logging::V2::LogEntrySourceLocation.new( file: file.to_s, line: line, function: function.to_s ) end