1

I am currently attempting to show log results (both Info and Error) to the frontend of a Wails V2 / React application.

Backend code:

for results.Next(ctx) {
    var singleTrack Track
    if err = results.Decode(&singleTrack); err != nil {
        log.Println(err)
    }

    baseFileName := "PMC_" + path.Base(singleTrack.FilePathUncompressed)
    downloadTarget := downloadUrl + singleTrack.FilePathCompressed

    resp, err := grab.Get(downloadDir+"/"+baseFileName, downloadTarget)

    if err != nil {
        log.Fatal(err)
    }

    // I would like to display the following log on the React frontend
    log.Info(resp.Filename)

    tracks = append(tracks, singleTrack)

    if singleTrack.Variations == nil {
        masterIds = append(masterIds, singleTrack.ID.Hex())
    } else {
        trackVariations := singleTrack.Variations.Variations
        for _, trackId := range trackVariations {
            masterIds = append(masterIds, trackId.TrackID)
        }
    }
}

I would like to Emit the logger to the ReactJS frontend, however all examples I have found use Wails V1 with Svelte.

Jamie_D
  • 979
  • 6
  • 13

0 Answers0