mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
Removed logs where possible, for now.
This commit is contained in:
parent
266110a51f
commit
d373237127
5 changed files with 9 additions and 14 deletions
|
|
@ -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 != "" {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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{}) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,13 +16,12 @@ func main() {
|
|||
}
|
||||
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("HANDLEFUNC", r.URL.Path)
|
||||
apiInit(w, r)
|
||||
})
|
||||
|
||||
log.Println("Listening on http://localhost:" + helper.EnvGet("MCRM__PORT"))
|
||||
|
||||
// helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT"))
|
||||
helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT"))
|
||||
|
||||
app.MCRMLog(http.ListenAndServe(":"+helper.EnvGet("MCRM__PORT"), nil))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue