log: fix custom output bug

R=r
CC=golang-dev
https://golang.org/cl/2525041
diff --git a/src/pkg/log/log.go b/src/pkg/log/log.go
index b52458a..50c01a3 100644
--- a/src/pkg/log/log.go
+++ b/src/pkg/log/log.go
@@ -136,7 +136,7 @@
 	if len(s) > 0 && s[len(s)-1] != '\n' {
 		buf.WriteByte('\n')
 	}
-	_, err := std.out.Write(buf.Bytes())
+	_, err := l.out.Write(buf.Bytes())
 	return err
 }
 
diff --git a/src/pkg/log/log_test.go b/src/pkg/log/log_test.go
index 0a5753f..67c0452 100644
--- a/src/pkg/log/log_test.go
+++ b/src/pkg/log/log_test.go
@@ -74,3 +74,13 @@
 		testPrint(t, testcase.flag, testcase.prefix, testcase.pattern, true)
 	}
 }
+
+func TestOutput(t *testing.T) {
+	const testString = "test"
+	var b bytes.Buffer
+	l := New(&b, "", 0)
+	l.Println(testString)
+	if expect := testString + "\n"; b.String() != expect {
+		t.Errorf("log output should match %q is %q", expect, b.String())
+	}
+}