コード例 #1
0
ファイル: clientserver.go プロジェクト: hashken/GoDCCP
// NewEnv creates a dccp.Env for test purposes, whose dccp.TraceWriter writes to a file
// and duplicates all emits to any number of additional guzzles, which are usually used to check
// test conditions. The TraceWriterPlex is returned to facilitate adding further guzzles.
func NewEnv(guzzleFilename string, guzzles ...dccp.TraceWriter) (env *dccp.Env, plex *TraceWriterPlex) {
	fileTraceWriter := dccp.NewFileTraceWriter(path.Join(os.Getenv("DCCPLOG"), guzzleFilename+".emit"))
	plex = NewTraceWriterPlex(append(guzzles, fileTraceWriter)...)
	return dccp.NewEnv(plex), plex
}
コード例 #2
0
ファイル: clientserver.go プロジェクト: HaMster21/GoDCCP
// NewEnv creates a dccp.Env for test purposes, whose dccp.TraceWriter writes to a file
// and duplicates all emits to any number of additional guzzles, which are usually used to check
// test conditions. The TraceWriterPlex is returned to facilitate adding further guzzles.
func NewEnv(guzzleFilename string) (env *dccp.Env, plex *TraceWriterPlex) {
	fileTraceWriter := dccp.NewFileTraceWriter(path.Join(os.Getenv("DCCPLOG"), guzzleFilename+".emit"))
	plex = NewTraceWriterPlex(fileTraceWriter)
	return dccp.NewEnv(NewSyncTraceWriter(plex)), plex
}