Created
March 4, 2015 01:35
-
-
Save lestrrat/281b5ecc69d3b3b9f12b to your computer and use it in GitHub Desktop.
とうとう脳内デバッグだけ追えるgoroutineの並列度を突破したのでトレース用のPrintfをあちこちに仕込むことにした
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package peco | |
import ( | |
"log" | |
"os" | |
) | |
type traceLogger interface { | |
Printf(string, ...interface{}) | |
} | |
type nullTraceLogger struct{} | |
func (ntl nullTraceLogger) Printf(_ string, _ ...interface{}) {} | |
var tracer traceLogger = nullTraceLogger{} | |
func init() { | |
if os.Getenv("PECO_TRACE") != "" { | |
tracer = log.New(os.Stderr, "", log.LstdFlags) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment