package logging
import "github.com/open-policy-agent/opa/logging"
Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
Index ¶
- Constants
- func DecisionIDFromContext(ctx context.Context) (string, bool)
- func NewContext(parent context.Context, val *RequestContext) context.Context
- func WithDecisionID(parent context.Context, id string) context.Context
- func WithHTTPRequestContext(parent context.Context, val *HTTPRequestContext) context.Context
- type HTTPRequestContext
- type Level
- type Logger
- type NoOpLogger
- type RequestContext
- type StandardLogger
Constants ¶
const ( // Error error log level Error = v1.Error // Warn warn log level Warn = v1.Warn // Info info log level Info = v1.Info // Debug debug log level Debug = v1.Debug )
Functions ¶
func DecisionIDFromContext ¶
func NewContext ¶
func NewContext(parent context.Context, val *RequestContext) context.Context
NewContext returns a copy of parent with an associated RequestContext.
func WithDecisionID ¶
func WithHTTPRequestContext ¶
func WithHTTPRequestContext(parent context.Context, val *HTTPRequestContext) context.Context
Types ¶
type HTTPRequestContext ¶
type HTTPRequestContext = v1.HTTPRequestContext
func HTTPRequestContextFromContext ¶
func HTTPRequestContextFromContext(ctx context.Context) (*HTTPRequestContext, bool)
type Level ¶
Level log level for Logger
type Logger ¶
Logger provides interface for OPA logger implementations
type NoOpLogger ¶
type NoOpLogger = v1.NoOpLogger
NoOpLogger logging implementation that does nothing
func NewNoOpLogger ¶
func NewNoOpLogger() *NoOpLogger
NewNoOpLogger instantiates new NoOpLogger
type RequestContext ¶
type RequestContext = v1.RequestContext
RequestContext represents the request context used to store data related to the request that could be used on logs.
func FromContext ¶
func FromContext(ctx context.Context) (*RequestContext, bool)
FromContext returns the RequestContext associated with ctx, if any.
type StandardLogger ¶
type StandardLogger = v1.StandardLogger
StandardLogger is the default OPA logger implementation.
func Get ¶
func Get() *StandardLogger
Get returns the standard logger used throughout OPA.
Deprecated. Do not rely on the global logger.
func New ¶
func New() *StandardLogger
New returns a new standard logger.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
logging/test | Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. |
- Version
- v1.4.2 (latest)
- Published
- May 2, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 4 hours ago –
Tools for package owners.