trace

package
v0.0.0-...-035f276 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder int

Encoder is enum that indicate how the tracer should encode the msgs.

const (
	// NONE no encoding.
	NONE Encoder = iota
	// JSON encode msg to json.
	JSON
)

type ITracer

type ITracer interface {
	// Logger Extend the logr.Logger interface
	logr.Logger
}

ITracer interface of tracer that extends the logr.Logger interface.

type ITracerFactory

type ITracerFactory interface {
	// CreateTracer creates ITracer interface.
	CreateTracer() (tracer ITracer)
}

ITracerFactory interface of tracer factory

type ITracerProvider

type ITracerProvider interface {
	// GetTracer Gets a tracer with specific context. the context is according to specific method
	//(when you create the ITraceProvider you choose the struct context)
	GetTracer(context string) (tracer ITracer)
}

ITracerProvider provides tracer. the difference between ITracerProvider and ITracerFactory is that ITracerFactory creates ITracer , and the ITracerProvider doesn't create tracer,it provides exists tracer in specific context.

type NoOpTracer

type NoOpTracer struct{}

NoOpTracer is implementation that does nothing of ITracer NoOp is used for testing/debugging.

func NewNoOpTracer

func NewNoOpTracer() *NoOpTracer

NewNoOpTracer Ctor for NoOpTracer

func (*NoOpTracer) Enabled

func (tracer *NoOpTracer) Enabled() bool

func (*NoOpTracer) Error

func (tracer *NoOpTracer) Error(err error, msg string, keysAndValues ...interface{})

func (*NoOpTracer) Info

func (tracer *NoOpTracer) Info(msg string, keysAndValues ...interface{})

func (*NoOpTracer) V

func (tracer *NoOpTracer) V(level int) logr.Logger

func (*NoOpTracer) WithName

func (tracer *NoOpTracer) WithName(name string) logr.Logger

func (*NoOpTracer) WithValues

func (tracer *NoOpTracer) WithValues(keysAndValues ...interface{}) logr.Logger

type NoOpTracerProvider

type NoOpTracerProvider struct {
}

NoOpTracerProvider is implementation that does nothing of ITracerProvider NoOp is used for testing/debugging.

func NewNoOpTracerProvider

func NewNoOpTracerProvider() *NoOpTracerProvider

NewNoOpTracerProvider Ctor for NoOpTracerProvider

func (*NoOpTracerProvider) GetTracer

func (provider *NoOpTracerProvider) GetTracer(context string) (tracer ITracer)

GetTracer Gets a tracer with specific context. the context is according to specific method (when you create the ITraceProvider you choose the struct context)

type TracerConfiguration

type TracerConfiguration struct {
	// TracerLevel is the level of the logger.
	TracerLevel zapcore.Level
	// DefaultTrace
	DefaultContext string
	// EncoderLogs
	EncoderLogs Encoder
}

TracerConfiguration is the configuration of the tracer.

type TracerProvider

type TracerProvider struct {
	// contains filtered or unexported fields
}

TracerProvider implements ITracerProvider interface. it wraps exists ITracer and add to ITracer context in the struct level. e.g. Server contains TracerProvider struct with the "Server" context.

func NewTracerProvider

func NewTracerProvider(tracer ITracer, context string) (provider *TracerProvider)

NewTracerProvider gets an exists ITracer and context, and it wraps the tracer with the new context

func (*TracerProvider) GetTracer

func (provider *TracerProvider) GetTracer(context string) (tracer ITracer)

GetTracer returns tracer with new context (the context now is in the method level - e.g. Server.Run is the context)

type ZaprTracerFactory

type ZaprTracerFactory struct {
	// contains filtered or unexported fields
}

ZaprTracerFactory implementation of ITracerFactory.

func NewZaprTracerFactory

func NewZaprTracerFactory(configuration *TracerConfiguration) *ZaprTracerFactory

NewZaprTracerFactory creates new TracerFactory instance.

func (*ZaprTracerFactory) CreateTracer

func (factory *ZaprTracerFactory) CreateTracer() (tracer ITracer)

CreateTracer Creates tracer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL