-log-level flag now -loglevel
Some checks failed
CI / Lint (push) Has been cancelled
Auto-Update Go Modules / update-go-modules (push) Has been cancelled

upd README, CHANGELOG
This commit is contained in:
onyx-and-iris 2025-04-05 22:15:29 +01:00
parent c7b9d75ea1
commit 09e4b107bf
3 changed files with 9 additions and 22 deletions

View File

@ -11,11 +11,11 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
- [x] - [x]
# [0.4.0] - 2025-04-04 # [0.4.1] - 2025-04-05
### Changed ### Changed
- `log-level` flag is now of type string. It accepts any one of trace, debug, info, warn, error, fatal or panic. - `-loglevel` flag is now of type string. It accepts any one of trace, debug, info, warn, error, fatal or panic.
- It defaults to warn. - It defaults to warn.
# [0.3.1] - 2025-03-31 # [0.3.1] - 2025-03-31

View File

@ -116,7 +116,7 @@ vbantxt -s=streamname "Point(ASIO128.IN[2],ASIO128.OUT[1]).dBGain = -8"
## `Logging` ## `Logging`
The `-log-level` flag allows you to control the verbosity of the application's logging output. The `-loglevel` flag allows you to control the verbosity of the application's logging output.
Acceptable values for this flag are: Acceptable values for this flag are:
@ -131,7 +131,7 @@ Acceptable values for this flag are:
For example, to set the log level to `debug`, you can use: For example, to set the log level to `debug`, you can use:
``` ```
vbantxt -s=streamname -log-level=debug "bus[0].eq.on=1 bus[1].gain=-12.8" vbantxt -s=streamname -loglevel=debug "bus[0].eq.on=1 bus[1].gain=-12.8"
``` ```
The default log level is `warn` if the flag is not specified. The default log level is `warn` if the flag is not specified.

View File

@ -23,7 +23,7 @@ type opts struct {
} }
func exit(err error) { func exit(err error) {
_, _ = fmt.Fprintf(os.Stderr, "Error: %s", err) _, _ = fmt.Fprintf(os.Stderr, "Error: %s\n", err)
os.Exit(1) os.Exit(1)
} }
@ -60,29 +60,16 @@ func main() {
defaultConfigPath := filepath.Join(configDir, "vbantxt", "config.toml") defaultConfigPath := filepath.Join(configDir, "vbantxt", "config.toml")
flag.StringVar(&configPath, "config", defaultConfigPath, "config path") flag.StringVar(&configPath, "config", defaultConfigPath, "config path")
flag.StringVar(&configPath, "C", defaultConfigPath, "config path (shorthand)") flag.StringVar(&configPath, "C", defaultConfigPath, "config path (shorthand)")
flag.StringVar(&loglevel, "log-level", "warn", "log level") flag.StringVar(&loglevel, "loglevel", "warn", "log level")
flag.StringVar(&loglevel, "l", "warn", "log level (shorthand)") flag.StringVar(&loglevel, "l", "warn", "log level (shorthand)")
flag.Parse() flag.Parse()
switch loglevel { level, err := log.ParseLevel(loglevel)
case "trace": if err != nil {
log.SetLevel(log.TraceLevel)
case "debug":
log.SetLevel(log.DebugLevel)
case "info":
log.SetLevel(log.InfoLevel)
case "warn":
log.SetLevel(log.WarnLevel)
case "error":
log.SetLevel(log.ErrorLevel)
case "fatal":
log.SetLevel(log.FatalLevel)
case "panic":
log.SetLevel(log.PanicLevel)
default:
exit(fmt.Errorf("invalid log level: %s", loglevel)) exit(fmt.Errorf("invalid log level: %s", loglevel))
} }
log.SetLevel(level)
o := opts{ o := opts{
host: host, host: host,