Documentation
¶
Index ¶
- Constants
- Variables
- func CreateComponentLogger(ctx context.Context, component string, config *logger.Config) (logger.Logger, error)
- func CreateLogger(ctx context.Context, config *logger.Config) (logger.Logger, error)
- func InitializeLogger(ctx context.Context, config *logger.Config) error
- func RunServer(ctx context.Context, opts *ServerOptions) error
- func ShutdownLogger() error
- type GRPCServiceRegistrar
- type LoggerImpl
- func (l *LoggerImpl) Debug() *zerolog.Event
- func (l *LoggerImpl) Error() *zerolog.Event
- func (l *LoggerImpl) Fatal() *zerolog.Event
- func (l *LoggerImpl) Info() *zerolog.Event
- func (l *LoggerImpl) Panic() *zerolog.Event
- func (l *LoggerImpl) SetDebug(debug bool)
- func (l *LoggerImpl) SetLevel(level zerolog.Level)
- func (l *LoggerImpl) Trace() *zerolog.Event
- func (l *LoggerImpl) Warn() *zerolog.Event
- func (l *LoggerImpl) With() zerolog.Context
- func (l *LoggerImpl) WithComponent(component string) zerolog.Logger
- func (l *LoggerImpl) WithFields(fields map[string]interface{}) zerolog.Logger
- type ServerOptions
- type Service
Constants ¶
const ( // Default max message sizes - can be overridden via environment variables DefaultMaxRecvSize = 4 * 1024 * 1024 // 4MB DefaultMaxSendSize = 4 * 1024 * 1024 // 4MB ShutdownTimeout = 10 * time.Second )
Variables ¶
var (
ErrInvalidSizeFormat = errors.New("invalid size format")
)
Static errors for err113 compliance
Functions ¶
func CreateComponentLogger ¶
func CreateComponentLogger(ctx context.Context, component string, config *logger.Config) (logger.Logger, error)
CreateComponentLogger creates a logger for a specific component.
func CreateLogger ¶
CreateLogger creates a new logger instance with the provided configuration. This returns a logger that can be injected into services.
func InitializeLogger ¶
InitializeLogger initializes the logger with the provided configuration. If config is nil, it uses the default configuration.
func RunServer ¶
func RunServer(ctx context.Context, opts *ServerOptions) error
RunServer starts a service with the provided options and handles lifecycle.
func ShutdownLogger ¶
func ShutdownLogger() error
ShutdownLogger shuts down the logger, flushing any pending logs.
Types ¶
type GRPCServiceRegistrar ¶
GRPCServiceRegistrar is a function type for registering gRPC services.
type LoggerImpl ¶
type LoggerImpl struct {
// contains filtered or unexported fields
}
LoggerImpl implements the logger.Logger interface without using global state
func NewLoggerImpl ¶
NewLoggerImpl creates a new logger implementation
func (*LoggerImpl) Debug ¶
func (l *LoggerImpl) Debug() *zerolog.Event
func (*LoggerImpl) Error ¶
func (l *LoggerImpl) Error() *zerolog.Event
func (*LoggerImpl) Fatal ¶
func (l *LoggerImpl) Fatal() *zerolog.Event
func (*LoggerImpl) Info ¶
func (l *LoggerImpl) Info() *zerolog.Event
func (*LoggerImpl) Panic ¶
func (l *LoggerImpl) Panic() *zerolog.Event
func (*LoggerImpl) SetDebug ¶
func (l *LoggerImpl) SetDebug(debug bool)
func (*LoggerImpl) SetLevel ¶
func (l *LoggerImpl) SetLevel(level zerolog.Level)
func (*LoggerImpl) Trace ¶ added in v1.0.55
func (l *LoggerImpl) Trace() *zerolog.Event
func (*LoggerImpl) Warn ¶
func (l *LoggerImpl) Warn() *zerolog.Event
func (*LoggerImpl) With ¶
func (l *LoggerImpl) With() zerolog.Context
func (*LoggerImpl) WithComponent ¶
func (l *LoggerImpl) WithComponent(component string) zerolog.Logger
func (*LoggerImpl) WithFields ¶
func (l *LoggerImpl) WithFields(fields map[string]interface{}) zerolog.Logger
type ServerOptions ¶
type ServerOptions struct {
ListenAddr string
ServiceName string
Service Service
RegisterGRPCServices []GRPCServiceRegistrar
EnableHealthCheck bool
Security *models.SecurityConfig
LoggerConfig *logger.Config
Logger logger.Logger // Optional: if provided, uses this logger instead of creating a new one
DisableTelemetry bool
TelemetryFilter grpc.TelemetryFilter
}
ServerOptions holds configuration for creating a server.