logger

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: BSD-3-Clause-Clear Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Currently setting AUDIT level to 10, a level above ERROR so it is always logged
	LevelAudit = slog.Level(10)
)

From the Slog docs (https://betterstack.com/community/guides/logging/logging-in-go/#customizing-slog-levels): The log/slog package provides four log levels by default, with each one associated with an integer value: DEBUG (-4), INFO (0), WARN (4), and ERROR (8).

Variables

View Source
var CustomLevelNames = map[slog.Leveler]string{
	LevelAudit: "AUDIT",
}

Functions

This section is empty.

Types

type AuditLog added in v0.4.3

type AuditLog struct {
	ID            string                 `json:"id"`
	Object        auditPolicyObject      `json:"object"`
	Action        auditPolicyAction      `json:"action"`
	Actor         AuditLogActor          `json:"actor"`
	EventMetaData map[string]interface{} `json:"eventMetaData"`
	ClientInfo    auditLogClientInfo     `json:"clientInfo"`
	Diff          map[string]interface{} `json:"diff"`
	Timestamp     string                 `json:"timestamp"`
}

type AuditLogActor added in v0.4.3

type AuditLogActor struct {
	ID         string                `json:"id"`
	Attributes auditPolicyAttributes `json:"attributes"`
}

type AuditLogger added in v0.4.3

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

func CreateAuditLogger added in v0.4.3

func CreateAuditLogger(logger slog.Logger) *AuditLogger

func (*AuditLogger) RewrapFailure added in v0.4.3

func (a *AuditLogger) RewrapFailure(ctx context.Context, policy AuditPolicy) error

KAS Rewrap Failure Event Log

func (*AuditLogger) RewrapSuccess added in v0.4.3

func (a *AuditLogger) RewrapSuccess(ctx context.Context, policy AuditPolicy) error

KAS Rewrap Success Event Log

func (*AuditLogger) With added in v0.4.3

func (a *AuditLogger) With(key string, value string) *AuditLogger

type AuditPolicy added in v0.4.3

type AuditPolicy struct {
	UUID  uuid.UUID       `json:"uuid"`
	Body  AuditPolicyBody `json:"body"`
	Actor AuditLogActor   `json:"actor"`
}

func CreateAuditPolicy added in v0.4.3

func CreateAuditPolicy(
	uuid uuid.UUID,
	dataAttributes []AuditPolicySimpleAttribute,
	policyDissem []string,
	entityToken jwt.Token,
) *AuditPolicy

Creates a simple Audit Policy to be passed into the audit rewrap logs

type AuditPolicyBody added in v0.4.3

type AuditPolicyBody struct {
	DataAttributes []AuditPolicySimpleAttribute `json:"dataAttributes"`
	Dissem         []string                     `json:"dissem"`
}

type AuditPolicySimpleAttribute added in v0.4.3

type AuditPolicySimpleAttribute struct {
	URI string `json:"attribute"`
}

type Config

type Config struct {
	Level  string `yaml:"level" default:"info"`
	Output string `yaml:"output" default:"stdout"`
	Type   string `yaml:"type" default:"json"`
}

type Logger

type Logger struct {
	*slog.Logger
	Audit *AuditLogger
}

func NewLogger

func NewLogger(config Config) (*Logger, error)

func (*Logger) With added in v0.4.1

func (l *Logger) With(key string, value string) *Logger

Jump to

Keyboard shortcuts

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