Removed logs where possible, for now.

This commit is contained in:
Jesse Malotaux 2025-04-12 15:30:51 +02:00
parent 266110a51f
commit d373237127
5 changed files with 9 additions and 14 deletions

View file

@ -2,7 +2,6 @@ package app
import (
"be/app/helper"
"log"
"mime"
"net/http"
"path/filepath"
@ -31,8 +30,6 @@ func ApiGet(w http.ResponseWriter, r *http.Request) {
file = "../public" + r.URL.Path // request
}
log.Println("ApiGet file: ", file)
contentType := mime.TypeByExtension(filepath.Ext(file)) // get content type
if contentType != "" {

View file

@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
"regexp"
"strings"
@ -50,19 +49,20 @@ func RunMacroSteps(steps []map[string]interface{}) error {
switch step["type"] {
case "key":
keyCode := step["code"].(string)
if strings.Contains(keyCode, "|") {
keyCode = handleToggleCode(keyCode, step["direction"].(string))
}
log.Println("keycode", keyCode, step["direction"].(string))
robotgo.KeyToggle(keyCode, step["direction"].(string))
case "delay":
log.Println("delay", step["value"].(float64))
time.Sleep(time.Duration(step["value"].(float64)) * time.Millisecond)
default:
return errors.New("RunMacroSteps Unknown step type: %v" + fmt.Sprint(step["type"]))
}
}
log.Println("-----")
return nil
}

View file

@ -16,7 +16,7 @@ func MCRMLogInit() {
}
// Optionally set log to write to file in addition to standard log output
// log.SetOutput(logFile)
log.SetOutput(logFile)
}
func MCRMLog(v ...interface{}) {

View file

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"path/filepath"
@ -40,8 +39,6 @@ func SaveMacro(w http.ResponseWriter, r *http.Request) {
return
}
log.Println(simplifiedSteps)
err = os.WriteFile("../macros/"+helper.FormatMacroFileName(newMacro.Name)+".json", stepsJSON, 0644)
if err != nil {
MCRMLog("SaveMacro WriteFile Error: ", err)
@ -111,7 +108,9 @@ func PlayMacro(data string, w http.ResponseWriter, r *http.Request) {
}
macro := req.Macro
log.Println("PlayMacro: ", macro)
MCRMLog("Playing Macro: ", macro)
var filename = helper.FormatMacroFileName(macro)
var filepath = fmt.Sprintf("../macros/%s.json", filename)