log

package
v1.26.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Level reports the minimum level to log.
	// Levels with lower levels are discarded.
	// If nil, the Handler uses [slog.LevelInfo].
	Level slog.Leveler
}

Options configures the behavior of the PluginHandler.

type PluginHandler

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

PluginHandler implements slog.Handler to integrate Go's structured logging with OpenVPN's plugin logging system. It forwards log messages to OpenVPN using the plugin_log callback function.

func NewOpenVPNPluginLogger

func NewOpenVPNPluginLogger(cb *c.OpenVPNPluginCallbacks) *PluginHandler

NewOpenVPNPluginLogger creates a new PluginHandler that sends log messages to OpenVPN via the plugin callback interface.

Parameters:

  • cb: OpenVPN plugin callbacks structure containing the plugin_log function
  • opts: Optional configuration for the handler (can be nil for defaults)

Returns:

  • *PluginHandler: A new handler that implements slog.Handler

func (*PluginHandler) Enabled

func (h *PluginHandler) Enabled(_ context.Context, level slog.Level) bool

func (*PluginHandler) Handle

func (h *PluginHandler) Handle(_ context.Context, record slog.Record) error

func (*PluginHandler) WithAttrs

func (h *PluginHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*PluginHandler) WithGroup

func (h *PluginHandler) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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