Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v2.100.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogEnforce

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

LogEnforce logs the enforcer information.

func LogError

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

LogError logs the error information.

func LogModel

func LogModel(model [][]string)

LogModel logs the model information.

func LogPolicy

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

LogPolicy logs the policy information.

func LogRole

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

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

func (*DefaultLogger) LogError

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

func (*DefaultLogger) LogModel

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

func (*DefaultLogger) LogPolicy

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

func (*DefaultLogger) LogRole

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