Documentation
¶
Overview ¶
Package boot provides application bootstrap, configuration lifecycle management, and logging initialization for Rays.
Index ¶
- type BootLoader
- func (this *BootLoader) Boot() Error
- func (this *BootLoader) Logger() Logging
- func (this *BootLoader) LoggerForClass(class any) Logging
- func (this *BootLoader) LoggerForType(rtype reflect.Type) Logging
- func (this *BootLoader) LoggerForTypes(types ...reflect.Type) Logging
- func (this *BootLoader) LoggingProperties() *LoggingProperties
- func (this *BootLoader) Reset()
- func (this *BootLoader) SetLoggingHandler(handler func(io.Writer, *slog.HandlerOptions) slog.Handler)
- type LogColor
- type LogHandler
- type LogLevel
- type LoggingProperties
- func (this *LoggingProperties) AddSource() bool
- func (this *LoggingProperties) Color() LogColor
- func (this *LoggingProperties) Format() string
- func (this *LoggingProperties) LogColor() LogColor
- func (this *LoggingProperties) LogHandler() LogHandler
- func (this *LoggingProperties) LogLevel() LogLevel
- func (this *LoggingProperties) MapLevels() map[string]LogLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootLoader ¶
BootLoader coordinates application initialization by orchestrating configuration loading, logging setup, and dependency service registration across bootstrap phases.
func NewBootLoader ¶
func NewBootLoader() *BootLoader
NewBootLoader creates and initializes a new BootLoader instance configured with default logging properties and a quiet error-level logger for initial bootstrap.
func (*BootLoader) Boot ¶
func (this *BootLoader) Boot() Error
Boot executes the bootstrap sequence: 1. Initializes configuration files and profiles in a quiet phase. 2. Extracts and unmarshals the "rays.logging" configuration section to reconfigure the logger. 3. Registers the configured logger in the global services registry. 4. Re-initializes the configuration container with full logging enabled.
Returns an error if configuration parsing or unmarshaling fails.
func (*BootLoader) Logger ¶
func (this *BootLoader) Logger() Logging
Logger returns the root application logger as a core.Logging instance.
func (*BootLoader) LoggerForClass ¶
func (this *BootLoader) LoggerForClass(class any) Logging
LoggerForClass returns a specialized core.Logging instance configured for the package or type of the provided struct pointer, respecting package-specific log level overrides.
func (*BootLoader) LoggerForType ¶
func (this *BootLoader) LoggerForType(rtype reflect.Type) Logging
LoggerForType returns a specialized core.Logging instance configured for the provided reflect.Type, applying the most specific log level override defined for its package path or type.
func (*BootLoader) LoggerForTypes ¶
func (this *BootLoader) LoggerForTypes(types ...reflect.Type) Logging
LoggerForTypes returns a specialized core.Logging instance configured for the first matching reflect.Type among candidate types, applying the most specific log level override.
func (*BootLoader) LoggingProperties ¶
func (this *BootLoader) LoggingProperties() *LoggingProperties
LoggingProperties returns the unmarshaled logging configuration properties populated during the bootstrap sequence, or nil if Boot has not yet been invoked.
func (*BootLoader) Reset ¶
func (this *BootLoader) Reset()
Reset restores the BootLoader, its underlying configuration container, and logging state back to their initial unbooted condition.
func (*BootLoader) SetLoggingHandler ¶
func (this *BootLoader) SetLoggingHandler(handler func(io.Writer, *slog.HandlerOptions) slog.Handler)
SetLoggingHandler sets a custom logging handler factory function to override the default slog handler constructed during bootstrap.
type LogColor ¶
LogColor defines the enumeration of terminal ANSI color output options (AUTO, ON, OFF).
type LogHandler ¶
type LogHandler struct {
Enum[LogHandler]
DEFAULT,
JSON,
TEXT,
ECS,
GELF,
LOGSTASH,
CUSTOM Enum[LogHandler]
}
LogHandler defines the enumeration of supported logging handler implementations.
func (*LogHandler) Handler ¶
func (this *LogHandler) Handler(format ...string) func(io.Writer, *slog.HandlerOptions) slog.Handler
Handler returns a factory function that constructs the slog.Handler corresponding to this LogHandler option.
type LoggingProperties ¶
type LoggingProperties struct {
ConfigurationProperties `Name:"rays.logging"`
// contains filtered or unexported fields
}
LoggingProperties holds configuration properties under the "rays.logging" namespace.
func (*LoggingProperties) AddSource ¶
func (this *LoggingProperties) AddSource() bool
AddSource reports whether caller source file and line information should be added to records.
func (*LoggingProperties) Color ¶
func (this *LoggingProperties) Color() LogColor
Color returns the configured ANSI color output mode, mirroring LogColor.
func (*LoggingProperties) Format ¶
func (this *LoggingProperties) Format() string
Format returns the pattern format string configured for custom log handlers.
func (*LoggingProperties) LogColor ¶
func (this *LoggingProperties) LogColor() LogColor
LogColor returns the configured ANSI color output mode.
func (*LoggingProperties) LogHandler ¶
func (this *LoggingProperties) LogHandler() LogHandler
LogHandler returns the configured log handler type.
func (*LoggingProperties) LogLevel ¶
func (this *LoggingProperties) LogLevel() LogLevel
LogLevel returns the configured logging severity level.
func (*LoggingProperties) MapLevels ¶
func (this *LoggingProperties) MapLevels() map[string]LogLevel
MapLevels returns the mapping of package paths or logger names to their configured log levels.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package config provides hierarchical application configuration loading, profile merging, overrides, type conversion, unmarshaling, and validation for Rays.
|
Package config provides hierarchical application configuration loading, profile merging, overrides, type conversion, unmarshaling, and validation for Rays. |
|
Package logger provides structured logging facilities with custom log levels, pattern layouts, ANSI color support, and slog integration for Rays.
|
Package logger provides structured logging facilities with custom log levels, pattern layouts, ANSI color support, and slog integration for Rays. |