my-log/formatters/null.go
Dan Jones 9f05f933dd ♲ Refactor configuration to use viper with context propagation
- Replace global ConfigPath and Overrides with viper-based configuration
- Add viper.New() to create configurable viper instances
- Store viper and unmarshaled Config struct in context for testability
- Add RetrieveFromContext and AddToContext helper functions
- Update files.Append to accept context and retrieve config from it
- Update formatters.Preferred and formatters.New to accept context
- Add PersistentPreRunE in CLI to create and configure viper instance
- Support -c flag for custom config file path
- Support -v flag for config value overrides
- Update all test files to create viper and add to context
- Remove unused config types and load functions
- Add viper as dependency with automatic env var support (MYLOG_*)
2026-03-09 13:46:01 -05:00

31 lines
505 B
Go

package formatters
import (
"codeberg.org/danjones000/my-log/models"
)
func newNull(ff map[string]any) (Formatter, error) {
return &Null{}, nil
}
type Null struct{}
func (n *Null) Name() string {
return "zero"
}
func (n *Null) Meta(m models.Meta) (o []byte, err error) {
return
}
func (n *Null) Entry(e models.Entry) (o []byte, err error) {
return
}
func (n *Null) Log(l models.Log) (o []byte, err error) {
return
}
func (n *Null) Logs(logs []models.Log) (out []byte, err error) {
return
}