/* Copyright © 2026 Craig Williams This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ package config import ( "fmt" "log/slog" ) // Prints configuration to stdout in flat dotted format func (conf JobSearchConfig) PrintTerminal() { fmt.Print(conf.String() + "\n") } // Prints configuration to stdout as JSON func (conf JobSearchConfig) PrintJson() { fmt.Print(conf.JSON() + "\n") } // Prints configuration to stdout as YAML func (conf JobSearchConfig) PrintYaml() { fmt.Print(conf.YAML() + "\n") } // Prints configuration to logrus log at debug, info (default) or error level func (conf JobSearchConfig) PrintLog(atLevel slog.Level) { var logFn func(args ...interface{}) switch atLevel { case slog.LevelDebug: logFn = func(args ...interface{}) { slog.Debug(fmt.Sprint(args...)) } case slog.LevelError: logFn = func(args ...interface{}) { slog.Error(fmt.Sprint(args...)) } case slog.LevelWarn: logFn = func(args ...interface{}) { slog.Warn(fmt.Sprint(args...)) } default: logFn = func(args ...interface{}) { slog.Info(fmt.Sprint(args...)) } } for k, v := range conf.Flatten() { logFn("\t", k, " = ", v) } }