logging

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentKey     = "useragent"
	SourceIpKey      = "source_ip"
	HostnameKey      = "hostname"
	ProtocolKey      = "protocol"
	PortKey          = "port"
	RequestUriKey    = "request_uri"
	RequestMethodKey = "request_method"
)
View Source
const APP_ID = "identity_platform.hook_service"

Variables

This section is empty.

Functions

func LogContextMiddleware added in v1.0.1

func LogContextMiddleware(next http.Handler) http.Handler

func NewServiceLogger added in v1.0.1

func NewServiceLogger(l string) *zap.SugaredLogger

Types

type Field added in v1.0.1

type Field = zap.Field

type LogEntry

type LogEntry struct {
	*LogFormatter
	// contains filtered or unexported fields
}

func (*LogEntry) Panic

func (l *LogEntry) Panic(v interface{}, stack []byte)

TODO @shipperizer see if implementing this or not

func (*LogEntry) Write

func (l *LogEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})

type LogFormatter

type LogFormatter struct {
	Logger LoggerInterface
}

LogFormatter is a simple logger that implements a middleware.LogFormatter.

func NewLogFormatter

func NewLogFormatter(logger LoggerInterface) *LogFormatter

func (*LogFormatter) NewLogEntry

func (l *LogFormatter) NewLogEntry(r *http.Request) middleware.LogEntry

NewLogEntry creates a new LogEntry for the request.

type Logger added in v1.0.1

type Logger struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(l string) *Logger

func NewNoopLogger

func NewNoopLogger() *Logger

func (*Logger) Security added in v1.0.1

func (l *Logger) Security() SecurityLoggerInterface

func (*Logger) Sync added in v1.0.1

func (l *Logger) Sync()

type LoggerInterface

type LoggerInterface interface {
	Errorf(string, ...interface{})
	Infof(string, ...interface{})
	Warnf(string, ...interface{})
	Debugf(string, ...interface{})
	Fatalf(string, ...interface{})
	Error(...interface{})
	Info(...interface{})
	Warn(...interface{})
	Debug(...interface{})
	Fatal(...interface{})
	Security() SecurityLoggerInterface
}

type Option added in v1.0.1

type Option []Field

func WithContext added in v1.0.1

func WithContext(ctx context.Context) Option

func WithLabel added in v1.0.1

func WithLabel(key, value string) Option

func WithRequest added in v1.0.1

func WithRequest(request *http.Request) Option

type SecurityLogger added in v1.0.1

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

func NewSecurityLogger added in v1.0.1

func NewSecurityLogger(l string) *SecurityLogger

NewSecurityLogger creates a new security logger instance

func (*SecurityLogger) AccountLockout added in v1.0.1

func (a *SecurityLogger) AccountLockout(user string, options ...Option)

func (*SecurityLogger) AdminAction added in v1.0.1

func (a *SecurityLogger) AdminAction(user, action, api, resource string, options ...Option)

func (*SecurityLogger) AuthzFailure added in v1.0.1

func (a *SecurityLogger) AuthzFailure(user, resource string, options ...Option)

func (*SecurityLogger) AuthzFailureApplicationAccess added in v1.0.1

func (a *SecurityLogger) AuthzFailureApplicationAccess(user, clientID string, options ...Option)

func (*SecurityLogger) AuthzFailureIdentityAssignment added in v1.0.1

func (a *SecurityLogger) AuthzFailureIdentityAssignment(user, identities string, options ...Option)

func (*SecurityLogger) AuthzFailureInsufficientPermissions added in v1.0.1

func (a *SecurityLogger) AuthzFailureInsufficientPermissions(user, action, api string, options ...Option)

func (*SecurityLogger) AuthzFailureNoSession added in v1.0.1

func (a *SecurityLogger) AuthzFailureNoSession(api string, options ...Option)

func (*SecurityLogger) AuthzFailureNotEmployee added in v1.0.1

func (a *SecurityLogger) AuthzFailureNotEmployee(user string, options ...Option)

func (*SecurityLogger) AuthzFailureRoleAssignment added in v1.0.1

func (a *SecurityLogger) AuthzFailureRoleAssignment(user, roles string, options ...Option)

func (*SecurityLogger) FailedLogin added in v1.0.1

func (a *SecurityLogger) FailedLogin(err string, options ...Option)

func (*SecurityLogger) PasswordChange added in v1.0.1

func (a *SecurityLogger) PasswordChange(user string, options ...Option)

func (*SecurityLogger) PasswordChangeFail added in v1.0.1

func (a *SecurityLogger) PasswordChangeFail(user string, options ...Option)

func (*SecurityLogger) SuccessfulLogin added in v1.0.1

func (a *SecurityLogger) SuccessfulLogin(user string, options ...Option)

func (*SecurityLogger) Sync added in v1.0.1

func (a *SecurityLogger) Sync()

func (*SecurityLogger) SystemCrash added in v1.0.1

func (a *SecurityLogger) SystemCrash(options ...Option)

func (*SecurityLogger) SystemRestart added in v1.0.1

func (a *SecurityLogger) SystemRestart(options ...Option)

func (*SecurityLogger) SystemShutdown added in v1.0.1

func (a *SecurityLogger) SystemShutdown(options ...Option)

func (*SecurityLogger) SystemStartup added in v1.0.1

func (a *SecurityLogger) SystemStartup(options ...Option)

func (*SecurityLogger) TokenCreate added in v1.0.1

func (a *SecurityLogger) TokenCreate(options ...Option)

func (*SecurityLogger) TokenDelete added in v1.0.1

func (a *SecurityLogger) TokenDelete(user string, options ...Option)

func (*SecurityLogger) TokenReuse added in v1.0.1

func (a *SecurityLogger) TokenReuse(token string, options ...Option)

func (*SecurityLogger) TokenRevoke added in v1.0.1

func (a *SecurityLogger) TokenRevoke(options ...Option)

type SecurityLoggerInterface added in v1.0.1

type SecurityLoggerInterface interface {
	SuccessfulLogin(string, ...Option)
	FailedLogin(string, ...Option)
	AccountLockout(string, ...Option)
	PasswordChange(string, ...Option)
	PasswordChangeFail(string, ...Option)
	TokenCreate(...Option)
	TokenRevoke(...Option)
	TokenReuse(string, ...Option)
	TokenDelete(string, ...Option)
	AdminAction(string, string, string, string, ...Option)
	AuthzFailure(string, string, ...Option)
	AuthzFailureNotEmployee(string, ...Option)
	AuthzFailureApplicationAccess(string, string, ...Option)
	AuthzFailureNoSession(string, ...Option)
	AuthzFailureInsufficientPermissions(string, string, string, ...Option)
	AuthzFailureRoleAssignment(string, string, ...Option)
	AuthzFailureIdentityAssignment(string, string, ...Option)
	SystemStartup(...Option)
	SystemShutdown(...Option)
	SystemRestart(...Option)
	SystemCrash(...Option)
}

Jump to

Keyboard shortcuts

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