github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/_examples/tracelevel.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ks888/tgo/lib/tracer"
     7  )
     8  
     9  func fib(n int) int {
    10  	if n == 0 || n == 1 {
    11  		return n
    12  	}
    13  	return fib(n-1) + fib(n-2)
    14  }
    15  
    16  func main() {
    17  	tracer.SetTraceLevel(2)
    18  	tracer.Start()
    19  
    20  	val := fib(3)
    21  	fmt.Println(val)
    22  
    23  	tracer.Stop()
    24  }