Documentation ¶
Index ¶
- Constants
- func LoggerExists(ctx context.Context) (exists bool)
- func WithLogger(ctx context.Context, logger *AuditLogger) context.Context
- type AuditLogger
- func (l *AuditLogger) Log(args ...interface{})
- func (l *AuditLogger) LogResult(err error, args ...interface{})
- func (l *AuditLogger) LogResultf(err error, format string, args ...interface{})
- func (l *AuditLogger) Logf(format string, args ...interface{})
- func (l *AuditLogger) SetFormatter(formatter logrus.Formatter)
Constants ¶
View Source
const ( LogEntryType = "openshift.logger" AuditUserEntry = "openshift.auth.user" AuditUserIDEntry = "openshift.auth.userid" AuditStatusEntry = "openshift.request.status" AuditErrorEntry = "openshift.request.error" DefaultLoggerType = "registry" AuditLoggerType = "audit" OpStatusBegin = "begin" OpStatusError = "error" OpStatusOK = "success" )
Variables ¶
This section is empty.
Functions ¶
func LoggerExists ¶
LoggerExists checks audit logger existence.
func WithLogger ¶
func WithLogger(ctx context.Context, logger *AuditLogger) context.Context
WithLogger creates a new context with provided logger.
Types ¶
type AuditLogger ¶
type AuditLogger struct {
// contains filtered or unexported fields
}
AuditLogger implements special audit log. We can't use the system logger because the change of log level can hide the audit logs.
func GetLogger ¶
func GetLogger(ctx context.Context) *AuditLogger
GetLogger returns the logger from the current context, if present. It will be created otherwise.
func MakeAuditLogger ¶
func MakeAuditLogger(ctx context.Context) *AuditLogger
MakeAuditLogger returns new audit logger which inherits fields from the system logger.
func (*AuditLogger) LogResult ¶
func (l *AuditLogger) LogResult(err error, args ...interface{})
LogResult logs record with additional operation status.
func (*AuditLogger) LogResultf ¶
func (l *AuditLogger) LogResultf(err error, format string, args ...interface{})
LogResultf formats record according to a format with additional operation status.
func (*AuditLogger) Logf ¶
func (l *AuditLogger) Logf(format string, args ...interface{})
Logf formats record according to a format.
func (*AuditLogger) SetFormatter ¶
func (l *AuditLogger) SetFormatter(formatter logrus.Formatter)
SetFormatter sets the audit logger formatter.
Click to show internal directories.
Click to hide internal directories.