package sdk
import "github.com/open-policy-agent/opa/sdk"
Index ¶
- type Level
- type Logger
- type NoOpLogger
- func NewNoOpLogger() *NoOpLogger
- func (*NoOpLogger) Debug(string, ...interface{})
- func (*NoOpLogger) Error(string, ...interface{})
- func (l *NoOpLogger) GetFields() map[string]interface{}
- func (l *NoOpLogger) GetLevel() Level
- func (*NoOpLogger) Info(string, ...interface{})
- func (l *NoOpLogger) SetLevel(level Level)
- func (*NoOpLogger) Warn(string, ...interface{})
- func (l *NoOpLogger) WithFields(fields map[string]interface{}) Logger
- type StandardLogger
- func NewStandardLogger() *StandardLogger
- func (l *StandardLogger) Debug(fmt string, a ...interface{})
- func (l *StandardLogger) Error(fmt string, a ...interface{})
- func (l *StandardLogger) GetFields() map[string]interface{}
- func (l *StandardLogger) GetLevel() Level
- func (l *StandardLogger) Info(fmt string, a ...interface{})
- func (l *StandardLogger) SetLevel(level Level)
- func (l *StandardLogger) Warn(fmt string, a ...interface{})
- func (l *StandardLogger) WithFields(fields map[string]interface{}) Logger
Types ¶
type Level ¶
type Level uint8
Level log level for Logger
const ( // Error error log level Error Level = iota // Warn warn log level Warn // Info info log level Info // Debug debug log level Debug )
type Logger ¶
type Logger interface { Debug(fmt string, a ...interface{}) Info(fmt string, a ...interface{}) Error(fmt string, a ...interface{}) Warn(fmt string, a ...interface{}) WithFields(map[string]interface{}) Logger GetFields() map[string]interface{} GetLevel() Level SetLevel(Level) }
Logger provides interface for OPA logger implementations
type NoOpLogger ¶
type NoOpLogger struct {
// contains filtered or unexported fields
}
NoOpLogger logging implementation that does nothing
func NewNoOpLogger ¶
func NewNoOpLogger() *NoOpLogger
NewNoOpLogger instantiates new NoOpLogger
func (*NoOpLogger) Debug ¶
func (*NoOpLogger) Debug(string, ...interface{})
Debug noop
func (*NoOpLogger) Error ¶
func (*NoOpLogger) Error(string, ...interface{})
Error noop
func (*NoOpLogger) GetFields ¶
func (l *NoOpLogger) GetFields() map[string]interface{}
GetFields returns additional fields of this logger Implemented here primarily to be able to switch between implementations without loss of data.
func (*NoOpLogger) GetLevel ¶
func (l *NoOpLogger) GetLevel() Level
GetLevel get log level
func (*NoOpLogger) Info ¶
func (*NoOpLogger) Info(string, ...interface{})
Info noop
func (*NoOpLogger) SetLevel ¶
func (l *NoOpLogger) SetLevel(level Level)
SetLevel set log level
func (*NoOpLogger) Warn ¶
func (*NoOpLogger) Warn(string, ...interface{})
Warn noop
func (*NoOpLogger) WithFields ¶
func (l *NoOpLogger) WithFields(fields map[string]interface{}) Logger
WithFields provides additional fields to include in log output. Implemented here primarily to be able to switch between implementations without loss of data.
type StandardLogger ¶
type StandardLogger struct {
// contains filtered or unexported fields
}
StandardLogger is the default OPA logger
func NewStandardLogger ¶
func NewStandardLogger() *StandardLogger
NewStandardLogger instantiates new default OPA logger
func (*StandardLogger) Debug ¶
func (l *StandardLogger) Debug(fmt string, a ...interface{})
Debug logs at debug level
func (*StandardLogger) Error ¶
func (l *StandardLogger) Error(fmt string, a ...interface{})
Error logs at error level
func (*StandardLogger) GetFields ¶
func (l *StandardLogger) GetFields() map[string]interface{}
GetFields returns additional fields of this logger
func (*StandardLogger) GetLevel ¶
func (l *StandardLogger) GetLevel() Level
GetLevel returns the standard logger level.
func (*StandardLogger) Info ¶
func (l *StandardLogger) Info(fmt string, a ...interface{})
Info logs at info level
func (*StandardLogger) SetLevel ¶
func (l *StandardLogger) SetLevel(level Level)
SetLevel sets the standard logger level.
func (*StandardLogger) Warn ¶
func (l *StandardLogger) Warn(fmt string, a ...interface{})
Warn logs at warn level
func (*StandardLogger) WithFields ¶
func (l *StandardLogger) WithFields(fields map[string]interface{}) Logger
WithFields provides additional fields to include in log output
Source Files ¶
- Version
- v0.27.0
- Published
- Mar 8, 2021
- Platform
- windows/amd64
- Imports
- 1 packages
- Last checked
- 24 minutes ago –
Tools for package owners.