# watch **Repository Path**: simpleelegant/watch ## Basic Information - **Project Name**: watch - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-08-29 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # watch use with `go generate` to generate special source code for debug purpose. ## Usage ### Install ``` go get gitee.com/yujian/watch ``` ### Use watch in you project ex. modify your source file `main.go` like this: ```go // +build !watch //go:generate watch package main import "fmt" func main() { // watch: xxx fmt.Println("process 1") // watch: yyy fmt.Println("process 2") } ``` run `go generate` should produce file `main_watch.go`: ```go // +build watch package main // generated by watch import "gitee.com/yujian/watch/watch" import "fmt" func main() { // generated by watch watch.Log("xxxStart") defer watch.Log("xxxEnd") fmt.Println("process 1") // generated by watch watch.Log("yyyStart") defer watch.Log("yyyEnd") fmt.Println("process 2") } ``` ### build "watch" version ``` go build -tags watch ``` then run the binary should generate "watch" log with path is `./watch.log`. ### To product report ex.: ``` watch -parse \ -original-data-file ./watch.log \ -output-title 'Time Consuming Analysis' ``` should generate `watch.html`, open it in your browser, enjoy it.