5 Commits

Author SHA1 Message Date
09e4b107bf -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
2025-04-05 22:15:29 +01:00
c7b9d75ea1 reword
Some checks failed
CI / Lint (push) Has been cancelled
2025-04-04 05:50:32 +01:00
cc42e928e0 upd tested against 2025-04-04 05:45:24 +01:00
80a675cc6a add/fix dates 2025-04-04 05:39:45 +01:00
6801d9e4e1 upd CHANGELOG 2025-04-04 05:38:46 +01:00
3 changed files with 25 additions and 25 deletions

View File

@@ -11,6 +11,19 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
- [x] - [x]
# [0.4.1] - 2025-04-05
### Changed
- `-loglevel` flag is now of type string. It accepts any one of trace, debug, info, warn, error, fatal or panic.
- It defaults to warn.
# [0.3.1] - 2025-03-31
### Fixed
- The CLI now uses `os.UserConfigDir()` to load the default *config.toml*, which should respect `$XDG_CONFIG_HOME`. See [UserConfigDir](https://pkg.go.dev/os#UserConfigDir)
# [0.2.1] - 2024-11-07 # [0.2.1] - 2024-11-07
### Fixed ### Fixed

View File

@@ -9,10 +9,10 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
## Tested against ## Tested against
- Basic 1.0.8.4 - Basic 1.1.1.8
- Banana 2.0.6.4 - Banana 2.1.1.8
- Potato 3.0.2.4 - Potato 3.1.1.8
- Matrix 1.0.0.3 - Matrix 1.0.1.2
## Requirements ## Requirements
@@ -84,7 +84,7 @@ Command line flags will override values in a config.toml.
## `Script files` ## `Script files`
The vbantxt-cli utility accepts a single string request or an array of string requests. This means you can pass scripts stored in files. The vbantxt CLI accepts a single string request or an array of string requests. This means you can pass scripts stored in files.
For example, in Windows with Powershell you could: For example, in Windows with Powershell you could:
@@ -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,