Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
568eccd1
Commit
568eccd1
authored
Oct 15, 2010
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: fix custom output bug
R=r CC=golang-dev
https://golang.org/cl/2525041
parent
0b2af925
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
log.go
src/pkg/log/log.go
+1
-1
log_test.go
src/pkg/log/log_test.go
+10
-0
No files found.
src/pkg/log/log.go
View file @
568eccd1
...
...
@@ -136,7 +136,7 @@ func (l *Logger) Output(calldepth int, s string) os.Error {
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
}
...
...
src/pkg/log/log_test.go
View file @
568eccd1
...
...
@@ -74,3 +74,13 @@ func TestAll(t *testing.T) {
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
())
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment