logid

package
v2.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IPUnknown represents unknown IP address.
	IPUnknown = "00000000000000000000000000000000"
)

Variables

This section is empty.

Functions

func AddLogIDIfNotExists

func AddLogIDIfNotExists(ctx context.Context) context.Context

AddLogIDIfNotExists checks log ID from ctx, if there is no log ID associated with it, it returns a new context with a new log ID.

func Gen

func Gen() string

Gen generates a new log ID string using the default generator.

func GetLogID

func GetLogID(ctx context.Context) string

GetLogID returns the associated log ID with ctx.

func NewCtx

func NewCtx() context.Context

NewCtx returns a new context with a log ID associated.

func SetLogID

func SetLogID(ctx context.Context, logId string) context.Context

SetLogID sets logId to ctx.

func SetRequestID

func SetRequestID(ctx context.Context, req *http.Request) string

SetRequestID gets log ID from ctx if available, or generates a new one, it sets the log ID to req as header "X-Request-ID".

Types

type Info

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

func Decode

func Decode(s string) (info Info)

func (Info) String

func (i Info) String() string

func (Info) Valid

func (i Info) Valid() bool

Jump to

Keyboard shortcuts

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