log

package
v2.87.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 84

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogEnforce added in v2.15.0

func LogEnforce(matcher string, request []interface{}, result bool, explains [][]string)

LogEnforce logs the enforcer information.

func LogError added in v2.75.0

func LogError(err error, msg ...string)

LogError logs the error information.

func LogModel added in v2.15.0

func LogModel(model [][]string)

LogModel logs the model information.

func LogPolicy added in v2.15.0

func LogPolicy(policy map[string][][]string)

LogPolicy logs the policy information.

func LogRole added in v2.15.0

func LogRole(roles []string)

LogRole log info related to role.

func SetLogger

func SetLogger(l Logger)

SetLogger sets the current logger.

Types

type DefaultLogger

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

DefaultLogger is the implementation for a Logger using golang log.

func (*DefaultLogger) EnableLog

func (l *DefaultLogger) EnableLog(enable bool)

func (*DefaultLogger) IsEnabled

func (l *DefaultLogger) IsEnabled() bool

func (*DefaultLogger) LogEnforce added in v2.15.0

func (l *DefaultLogger) LogEnforce(matcher string, request []interface{}, result bool, explains [][]string)

func (*DefaultLogger) LogError added in v2.75.0

func (l *DefaultLogger) LogError(err error, msg ...string)

func (*DefaultLogger) LogModel added in v2.15.0

func (l *DefaultLogger) LogModel(model [][]string)

func (*DefaultLogger) LogPolicy added in v2.15.0

func (l *DefaultLogger) LogPolicy(policy map[string][][]string)

func (*DefaultLogger) LogRole added in v2.15.0

func (l *DefaultLogger) LogRole(roles []string)

type Logger

type Logger interface {
	// EnableLog controls whether print the message.
	EnableLog(bool)

	// IsEnabled returns if logger is enabled.
	IsEnabled() bool

	// LogModel log info related to model.
	LogModel(model [][]string)

	// LogEnforce log info related to enforce.
	LogEnforce(matcher string, request []interface{}, result bool, explains [][]string)

	// LogRole log info related to role.
	LogRole(roles []string)

	// LogPolicy log info related to policy.
	LogPolicy(policy map[string][][]string)

	// LogError log info relate to error
	LogError(err error, msg ...string)
}

Logger is the logging interface implementation.

func GetLogger

func GetLogger() Logger

GetLogger returns the current logger.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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