pipelog.go raw

   1  package main
   2  
   3  import (
   4  	"github.com/p9c/p9/pkg/log"
   5  	"github.com/p9c/p9/pkg/pipe"
   6  
   7  	"os"
   8  	"time"
   9  
  10  	"github.com/p9c/p9/pkg/qu"
  11  )
  12  
  13  func main() {
  14  	// var e error
  15  	log.SetLogLevel("trace")
  16  	// command := "pod -D test0 -n testnet -l trace --solo --lan --pipelog node"
  17  	quit := qu.T()
  18  	// splitted := strings.Split(command, " ")
  19  	splitted := os.Args[1:]
  20  	w := pipe.LogConsume(quit, pipe.SimpleLog(splitted[len(splitted)-1]), pipe.FilterNone, splitted...)
  21  	D.Ln("\n\n>>> >>> >>> >>> >>> >>> >>> >>> >>> starting")
  22  	pipe.Start(w)
  23  	D.Ln("\n\n>>> >>> >>> >>> >>> >>> >>> >>> >>> started")
  24  	time.Sleep(time.Second * 4)
  25  	D.Ln("\n\n>>> >>> >>> >>> >>> >>> >>> >>> >>> stopping")
  26  	pipe.Kill(w)
  27  	D.Ln("\n\n>>> >>> >>> >>> >>> >>> >>> >>> >>> stopped")
  28  	// time.Sleep(time.Second * 5)
  29  	// D.Ln(interrupt.GoroutineDump())
  30  	// if e = w.Wait(); E.Chk(e) {
  31  	// }
  32  	// time.Sleep(time.Second * 3)
  33  }
  34