Documentation ¶
Index ¶
- Constants
- func GetLogger(ctx context.Context, opt Option) dcontext.Logger
- func GetTraceID(ctx context.Context) string
- func InitContext(ctx context.Context, r *http.Request) context.Context
- func InitLogConfig(config Config) error
- func SetTraceIDHeader(ctx context.Context, header http.Header) http.Header
- type Config
- type ContextKey
- type Option
Constants ¶
View Source
const ( // ContextKeyTraceID is the context key for the trace ID. ContextKeyTraceID = ContextKey("trace-id") // ContextKeyComponentType is the context key for the component type. ContextKeyComponentType = ContextKey("component-type") // Executor is the component type for the executor. Executor componentType = "executor" // Server is the component type for the Ratify http server. Server componentType = "server" // CommandLine is the component type for the Ratify command line. CommandLine componentType = "commandLine" // ReferrerStore is the component type for the referrer store. ReferrerStore componentType = "referrerStore" // Cache is the component type for the cache. Cache componentType = "cache" // CertProvider is the component type for certificate provider. CertProvider componentType = "certificateProvider" // KeyManagementProvider is the component type for key management provider. KeyManagementProvider componentType = "keyManagementProvider" // AuthProvider is the component type for auth provider. AuthProvider componentType = "authProvider" // PolicyProvider is the component type for policy provider. PolicyProvider componentType = "policyProvider" // Verifier is the component type for verifier. Verifier componentType = "verifier" // Plugin is the component type for plugin. Plugin componentType = "plugin" )
Variables ¶
This section is empty.
Functions ¶
func GetTraceID ¶
GetTraceID returns the trace ID from the context.
func InitContext ¶
InitContext initializes the context with required loggers for a request.
func InitLogConfig ¶
InitLogConfig initializes log configuration for the server.
Types ¶
type Config ¶
type Config struct { Formatter string `json:"formatter,omitempty"` RequestHeaders map[string]interface{} `json:"requestHeaders"` }
Config is the configuration for the logger.
type ContextKey ¶
type ContextKey string
ContextKey defines the key type used for the context.
func (ContextKey) String ¶
func (c ContextKey) String() string
String returns the string representation of the context key.
Click to show internal directories.
Click to hide internal directories.