Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
discard logging for production (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne authored Jan 20, 2022
1 parent 52c32d4 commit c29c9c7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
Binary file modified build/com.exension.hwinfo.streamDeckPlugin
Binary file not shown.
44 changes: 26 additions & 18 deletions cmd/hwinfo_streamdeck_plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"io/ioutil"
"log"

// "net/http"
Expand All @@ -28,24 +29,31 @@ func main() {
log.Fatalf("Unable to chdir: %v", err)
}

appdata := os.Getenv("APPDATA")
logpath := filepath.Join(appdata, "Elgato/StreamDeck/Plugins/com.exension.hwinfo.sdPlugin/hwinfo.log")
f, err := os.OpenFile(logpath, os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
log.Fatalf("OpenFile Log: %v", err)
}
err = f.Truncate(0)
if err != nil {
log.Fatalf("Truncate Log: %v", err)
}
defer func() {
err := f.Close()
if err != nil {
log.Fatalf("File Close: %v", err)
}
}()
log.SetOutput(f)
log.SetFlags(0)
// PRODUCTION
// LOGGING DISABLED:
//
log.SetOutput(ioutil.Discard)

// DEBUG LOGGING:
//
// appdata := os.Getenv("APPDATA")
// logpath := filepath.Join(appdata, "Elgato/StreamDeck/Plugins/com.exension.hwinfo.sdPlugin/hwinfo.log")
// f, err := os.OpenFile(logpath, os.O_RDWR|os.O_CREATE, 0666)
// if err != nil {
// log.Fatalf("OpenFile Log: %v", err)
// }
// err = f.Truncate(0)
// if err != nil {
// log.Fatalf("Truncate Log: %v", err)
// }
// defer func() {
// err := f.Close()
// if err != nil {
// log.Fatalf("File Close: %v", err)
// }
// }()
// log.SetOutput(f)
// log.SetFlags(0)

flag.Parse()

Expand Down
9 changes: 3 additions & 6 deletions com.exension.hwinfo.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@
"Name": "HWiNFO",
"Icon": "pluginIcon",
"URL": "https://github.com/exension/hwinfo-streamdeck",
"Version": "2.0.2",
"Version": "2.0.3",
"ApplicationsToMonitor": {
"windows": [
"HWiNFO64.EXE",
"HWiNFO64.exe"
]
"windows": ["HWiNFO64.EXE", "HWiNFO64.exe"]
},
"OS": [
{
"Platform": "windows",
"MinimumVersion": "10"
}
]
}
}

0 comments on commit c29c9c7

Please sign in to comment.