github.com/brownsys/tracing-framework-go@v0.0.0-20161210174012-0542a62412fe/xtrace/client/test/main_local.go (about)

     1  // +build local
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"sync"
     9  	"time"
    10  
    11  	"github.com/brownsys/tracing-framework-go/local"
    12  	"github.com/brownsys/tracing-framework-go/xtrace/client"
    13  )
    14  
    15  func main() {
    16  	err := client.Connect("localhost:5563")
    17  	if err != nil {
    18  		fmt.Fprintf(os.Stderr, "connect to X-Trace server: %v\n", err)
    19  		os.Exit(1)
    20  	}
    21  
    22  	client.Log("1")
    23  	client.Log("2")
    24  	client.Log("3")
    25  
    26  	var wg sync.WaitGroup
    27  	wg.Add(1)
    28  	go func(__f1 func(), __f2 func()) {
    29  		__f1()
    30  		__f2()
    31  	}(local.GetSpawnCallback(), func() {
    32  		client.Log("4")
    33  
    34  		wg.Done()
    35  	})
    36  
    37  	client.Log("5")
    38  	wg.Wait()
    39  
    40  	time.Sleep(time.Hour)
    41  }