This is a tool for monitoring and parsing the MTGA output_log.txt file.
filepath.Join(os.Getenv("APPDATA"), "..", "LocalLow", "Wizards Of The Coast", "MTGA", "output_log.txt")
Jul 25, Update v0.17: PDF | TXT
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"github.com/di-wu/mtga"
"github.com/di-wu/mtga/thread/outgoing"
"github.com/di-wu/mtga/thread/outgoing/log/client"
)
var filePath string
func main() {
flag.StringVar(&filePath, "file", filepath.Join(os.Getenv("APPDATA"), "..", "LocalLow", "Wizards Of The Coast", "MTGA", "output_log.txt"), "Location to the MTGAs log file.")
flag.Parse()
parser := mtga.Parser{}
parser.OnAuthenticate(func(auth outgoing.Authenticate) {
fmt.Println("Authenticated!")
})
parser.OnInventoryReport(func(report client.InventoryReport) {
fmt.Printf("Gold: %d, Gems %d\n", report.Gold, report.Gems)
})
t, _ := mtga.NewTail(filePath)
for l := range t.Logs() {
parser.Parse(l)
}
}
There are probably still some logs that don't have a callback or are just not that relevant.
parser.OnUnknownLog(func(message string) {
log.Println(message)
})