Skip to content

gathering-gg/parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic: The Gathering Arena Log Parser

Build Status GoDoc

Parser is a Go library and command line interface to parse the output_log.txt created by MTGA. Cross platform with minimal dependencies, the executable is small. The CLI is currently used to send the parsed data to Gathering.gg, and you need an account to use it. Future work can be done to parse the data to local files.

Usage

To use the parser, you'll need a Go dev environment. To use the parser locally:

$ go get github.com/gathering-gg/parser

If you want to install the CLI and use that:

$ go install github.com/gathering-gg/parser/cli

You can then execute it by running (You may need to add Go's bin to your path):

$ gathering -token=YOUR_GATHERING_GG_TOKEN

You can get your token from Gathering.gg.

Binaries

If you just want to execute a binary, you can get them from the releases page.

Development

Once you have your Go dev environment setup, fetch the library:

$ go get github.com/gathering-gg/parser
$ cd $GOPATH/src/github.com/gathering-gg/parser

You can the start hacking on the library. To build the library, you run go build, however there are some compile time variables that should be set. The current command used to build is:

go build -ldflags "-X 'github.com/gathering-gg/gathering/config.Root=https://api.gathering.gg' -X 'github.com/gathering-gg/gathering/config.Version=0.0.1'" -o gathering ./cli

You can also build for specific platforms by appending GOOS and GOARCH environment variables.

Tests:

$ go test -v ./...

Changelog

See the releases page.

Contributing

Please contribute! If you have a problem with the parser you can open an issue. Feel free to ask for new features as well!

Profiling

https://blog.golang.org/profiling-go-programs

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var memprofile = flag.String("memprofile", "", "write memory profile to this file")

// 

if *cpuprofile != "" {
  f, err := os.Create("cpu.prof")
    if err != nil {
      log.Fatal(err)
    }
  pprof.StartCPUProfile(f)
    defer pprof.StopCPUProfile()
}
if *memprofile != "" {
  f, err := os.Create(*memprofile)
    if err != nil {
      log.Fatal(err)
    }
  defer func() {
    pprof.WriteHeapProfile(f)
      f.Close()
  }()
}

// Add onChange(file) to bottom of main()