Documentation ¶
Overview ¶
Location defines where a log event happens. This is usually a package/type/function and it's corresponding line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDiscovery = NoopDiscovery()
DefaultDiscovery is the default instance of Discovery which should cover the majority of the cases.
Functions ¶
This section is empty.
Types ¶
type Caller ¶ added in v0.9.0
type Caller interface { Location // GetFrame provides the runtime.Frame of the initial caller. GetFrame() runtime.Frame }
Caller describes the Location of the caller which leads to the initial creation of an log.Event.
type CallerDiscovery ¶ added in v0.9.0
type CallerDiscovery struct { ReportingType CallerReportingType ReportingDetail CallerReportingDetail }
CallerDiscovery implements Discovery that discovers the Caller's Location of a provided log.Event.
func NewCallerDiscovery ¶ added in v0.9.0
func NewCallerDiscovery(customizer ...func(*CallerDiscovery)) *CallerDiscovery
NewCallerDiscovery create a new instance of CallerDiscovery which is ready to use.
func (*CallerDiscovery) DiscoverLocation ¶ added in v0.9.0
func (instance *CallerDiscovery) DiscoverLocation(_ log.Event, skipFrames uint16) Location
DiscoverLocation implements Discovery.DiscoverLocation().
type CallerReportingDetail ¶ added in v0.9.0
type CallerReportingDetail uint8
CallerReportingDetail defines how detailed Caller will report the caller location, of requested.
const ( // CallerReportingDetailDetailed will report the full available details of // the configured CallerReportingType. CallerReportingDetailDetailed CallerReportingDetail = 0 // CallerReportingDetailSimplified will report a simplified version of all // available details of the configured CallerReportingType. It is focussed // to be still detailed enough to get a meaningful understanding about the // location but still keep it short. CallerReportingDetailSimplified CallerReportingDetail = 1 )
type CallerReportingType ¶ added in v0.9.0
type CallerReportingType uint8
CallerReportingType defines how Caller should report the caller location, if requested.
const ( // CallerReportingTypePrefersType will prefer to report the caller's type // (package/type/function). If this is not possible the file will be // reported instead. CallerReportingTypePrefersType CallerReportingType = 0 // CallerReportingTypePrefersFile will prefer to report the caller's file. // If this is not possible the type (package/type/function) will be used // instead. CallerReportingTypePrefersFile CallerReportingType = 1 )
type DepthOnly ¶ added in v0.10.0
type DepthOnly uint16
DepthOnly is a location which expresses only the depth where a log event was captured.
type Discovery ¶ added in v0.9.0
type Discovery interface { // DiscoverLocation discovers the Location for the given log.Event. It will // return <nil> if it is either not possible to discover the Location or // there is a reason to not return it. DiscoverLocation(event log.Event, skipFrames uint16) Location }
Discovery is used to discover the Location where an log.Event happened.
func NewDepthOnlyDiscovery ¶ added in v0.10.0
func NewDepthOnlyDiscovery() Discovery
NewDepthOnlyDiscovery provides a Discovery to create DepthOnly instances.
func NewDiscoveryFacade ¶ added in v0.9.0
NewDiscoveryFacade creates a facade of KeysSpec using the given provider.
func NoopDiscovery ¶ added in v0.9.0
func NoopDiscovery() Discovery
NoopDiscovery provides a noop implementation of Discovery.
type DiscoveryFunc ¶ added in v0.9.0
DiscoveryFunc is wrapping a given function into a Discovery.
func (DiscoveryFunc) DiscoverLocation ¶ added in v0.9.0
func (instance DiscoveryFunc) DiscoverLocation(event log.Event, skipFrames uint16) Location
DiscoverLocation implements Discovery.DiscoverLocation()