debug logging added to getters/setters in iRemote

This commit is contained in:
onyx-and-iris 2022-12-08 10:27:34 +00:00
parent 62b4956279
commit e01efb22eb

View File

@ -2,6 +2,8 @@ package voicemeeter
import ( import (
"fmt" "fmt"
log "github.com/sirupsen/logrus"
) )
// iRemote provides an interface between higher methods and lower functions // iRemote provides an interface between higher methods and lower functions
@ -19,6 +21,7 @@ func (ir *iRemote) identifier() string {
// getter_bool returns the value of a boolean parameter // getter_bool returns the value of a boolean parameter
func (ir *iRemote) getter_bool(p string) bool { func (ir *iRemote) getter_bool(p string) bool {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) param := fmt.Sprintf("%s.%s", ir.identifier(), p)
log.Debug("getter_bool::", param)
val, err := getParameterFloat(param) val, err := getParameterFloat(param)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -35,6 +38,7 @@ func (ir *iRemote) setter_bool(p string, v bool) {
} else { } else {
value = 0 value = 0
} }
log.Debug("setter_bool::", param, "=", v)
err := setParameterFloat(param, float64(value)) err := setParameterFloat(param, float64(value))
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -44,6 +48,7 @@ func (ir *iRemote) setter_bool(p string, v bool) {
// getter_int returns the value of an int parameter p // getter_int returns the value of an int parameter p
func (ir *iRemote) getter_int(p string) int { func (ir *iRemote) getter_int(p string) int {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) param := fmt.Sprintf("%s.%s", ir.identifier(), p)
log.Debug("getter_int::", param)
val, err := getParameterFloat(param) val, err := getParameterFloat(param)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -54,15 +59,22 @@ func (ir *iRemote) getter_int(p string) int {
// setter_int sets the value v of an int parameter p // setter_int sets the value v of an int parameter p
func (ir *iRemote) setter_int(p string, v int) { func (ir *iRemote) setter_int(p string, v int) {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) param := fmt.Sprintf("%s.%s", ir.identifier(), p)
log.Debug("setter_int::", param, "=", v)
err := setParameterFloat(param, float64(v)) err := setParameterFloat(param, float64(v))
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
} }
// getter_float returns the value of an int parameter p // getter_float returns the value of a float parameter p
func (ir *iRemote) getter_float(p string) float64 { func (ir *iRemote) getter_float(p string) float64 {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) var param string
if p != "" {
param = fmt.Sprintf("%s.%s", ir.identifier(), p)
} else {
param = ir.identifier()
}
log.Debug("getter_float::", param)
val, err := getParameterFloat(param) val, err := getParameterFloat(param)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -70,9 +82,15 @@ func (ir *iRemote) getter_float(p string) float64 {
return val return val
} }
// setter_float sets the value v of an int parameter p // setter_float sets the value v of an float parameter p
func (ir *iRemote) setter_float(p string, v float64) { func (ir *iRemote) setter_float(p string, v float64) {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) var param string
if p != "" {
param = fmt.Sprintf("%s.%s", ir.identifier(), p)
} else {
param = ir.identifier()
}
log.Debug("setter_float::", param, "=", v)
err := setParameterFloat(param, float64(v)) err := setParameterFloat(param, float64(v))
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -82,6 +100,7 @@ func (ir *iRemote) setter_float(p string, v float64) {
// getter_string returns the value of a string parameter p // getter_string returns the value of a string parameter p
func (ir *iRemote) getter_string(p string) string { func (ir *iRemote) getter_string(p string) string {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) param := fmt.Sprintf("%s.%s", ir.identifier(), p)
log.Debug("getter_string::", param)
val, err := getParameterString(param) val, err := getParameterString(param)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -92,6 +111,7 @@ func (ir *iRemote) getter_string(p string) string {
// setter_string sets the value v of a string parameter p // setter_string sets the value v of a string parameter p
func (ir *iRemote) setter_string(p, v string) { func (ir *iRemote) setter_string(p, v string) {
param := fmt.Sprintf("%s.%s", ir.identifier(), p) param := fmt.Sprintf("%s.%s", ir.identifier(), p)
log.Debug("setter_string::", param, "=", v)
err := setParameterString(param, v) err := setParameterString(param, v)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)