Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我正在使用以下方法运行单元测试: godep go test -v -run TestMyCode,
godep go test -v -run TestMyCode
但我没有找到在我的测试中显示我的信息日志的方法:
glog.V(4).Infof("Adding new pods from source %s : %v", source, update.Pods)
可能吗?
您可以通过设置一些标志将消息记录到控制台。在 init() 函数中尝试以下代码。
flag.Set("alsologtostderr", fmt.Sprintf("%t", true)) var logLevel string flag.StringVar(&logLevel, "logLevel", "4", "test") flag.Lookup("v").Value.Set(logLevel)