Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c54699c9
Commit
c54699c9
authored
May 15, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s/NewLogger/New/
R=rsc DELTA=7 (0 added, 0 deleted, 7 changed) OCL=28947 CL=28950
parent
96890d42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/lib/log/log.go
src/lib/log/log.go
+6
-6
src/lib/log/log_test.go
src/lib/log/log_test.go
+1
-1
No files found.
src/lib/log/log.go
View file @
c54699c9
...
...
@@ -45,19 +45,19 @@ type Logger struct {
flag
int
;
// properties
}
// New
Logger
creates a new Logger. The out0 and out1 variables set the
// New creates a new Logger. The out0 and out1 variables set the
// destinations to which log data will be written; out1 may be nil.
// The prefix appears at the beginning of each generated log line.
// The flag argument defines the logging properties.
func
New
Logger
(
out0
,
out1
io
.
Writer
,
prefix
string
,
flag
int
)
*
Logger
{
func
New
(
out0
,
out1
io
.
Writer
,
prefix
string
,
flag
int
)
*
Logger
{
return
&
Logger
{
out0
,
out1
,
prefix
,
flag
}
}
var
(
stdout
=
New
Logger
(
os
.
Stdout
,
nil
,
""
,
Lok
|
Ldate
|
Ltime
);
stderr
=
New
Logger
(
os
.
Stderr
,
nil
,
""
,
Lok
|
Ldate
|
Ltime
);
exit
=
New
Logger
(
os
.
Stderr
,
nil
,
""
,
Lexit
|
Ldate
|
Ltime
);
crash
=
New
Logger
(
os
.
Stderr
,
nil
,
""
,
Lcrash
|
Ldate
|
Ltime
);
stdout
=
New
(
os
.
Stdout
,
nil
,
""
,
Lok
|
Ldate
|
Ltime
);
stderr
=
New
(
os
.
Stderr
,
nil
,
""
,
Lok
|
Ldate
|
Ltime
);
exit
=
New
(
os
.
Stderr
,
nil
,
""
,
Lexit
|
Ldate
|
Ltime
);
crash
=
New
(
os
.
Stderr
,
nil
,
""
,
Lcrash
|
Ldate
|
Ltime
);
)
var
shortnames
=
make
(
map
[
string
]
string
)
// cache of short names to avoid allocation.
...
...
src/lib/log/log_test.go
View file @
c54699c9
...
...
@@ -54,7 +54,7 @@ func testLog(t *testing.T, flag int, prefix string, pattern string, useLogf bool
defer
r
.
Close
();
defer
w
.
Close
();
buf
:=
bufio
.
NewReader
(
r
);
l
:=
New
Logger
(
w
,
nil
,
prefix
,
flag
);
l
:=
New
(
w
,
nil
,
prefix
,
flag
);
if
useLogf
{
l
.
Logf
(
"hello %d world"
,
23
);
}
else
{
...
...
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