Documentation
¶
Overview ¶
Package server provides an embedded NATS server implementation.
Index ¶
- Variables
- type NATSServerInstance
- type Options
- type Server
- type SlogWrapper
- func (l *SlogWrapper) Debugf(format string, v ...interface{})
- func (l *SlogWrapper) Errorf(format string, v ...interface{})
- func (l *SlogWrapper) Fatalf(format string, v ...interface{})
- func (l *SlogWrapper) Noticef(format string, v ...interface{})
- func (l *SlogWrapper) Tracef(format string, v ...interface{})
- func (l *SlogWrapper) Warnf(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
var NewNATSServer = func( opts *natsserver.Options, ) (NATSServerInstance, error) { return natsserver.NewServer(opts) }
NewNATSServer is a public variable function wrapping natsserver.NewServer.
Functions ¶
This section is empty.
Types ¶
type NATSServerInstance ¶
type NATSServerInstance interface {
Start()
ReadyForConnections(timeout time.Duration) bool
SetLogger(logger natsserver.Logger, debug, trace bool)
Shutdown()
}
NATSServerInstance defines an interface for the NATS server operations used by Start() and Stop().
type Options ¶
type Options struct {
*natsserver.Options
ReadyTimeout time.Duration
}
Options extends natsserver.Options to include custom settings.
type Server ¶
type Server struct {
// Opts configuration options for the embedded NATS server.
Opts *Options
// contains filtered or unexported fields
}
Server provides an embedded NATS server implementation.
type SlogWrapper ¶
type SlogWrapper struct {
// contains filtered or unexported fields
}
SlogWrapper wraps an slog.Logger to implement the NATS Logger interface. Note: slog is designed for structured logging, using key-value pairs. However, since the NATS logger interface uses printf-style formatting (e.g., "%s", "%q"), we use fmt.Sprintf to manually format the message before passing it to slog. This ensures compatibility between NATS's formatting needs and slog's structured logging.
func (*SlogWrapper) Debugf ¶
func (l *SlogWrapper) Debugf( format string, v ...interface{}, )
Debugf logs a formatted debug message.
func (*SlogWrapper) Errorf ¶
func (l *SlogWrapper) Errorf( format string, v ...interface{}, )
Errorf logs a formatted error message.
func (*SlogWrapper) Fatalf ¶
func (l *SlogWrapper) Fatalf( format string, v ...interface{}, )
Fatalf logs a formatted fatal error message.
func (*SlogWrapper) Noticef ¶
func (l *SlogWrapper) Noticef( format string, v ...interface{}, )
Noticef logs a formatted notice message.
func (*SlogWrapper) Tracef ¶
func (l *SlogWrapper) Tracef( format string, v ...interface{}, )
Tracef logs a formatted trace message (NATS requires this for tracing).
func (*SlogWrapper) Warnf ¶
func (l *SlogWrapper) Warnf( format string, v ...interface{}, )
Warnf logs a formatted warning message.