Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
38e27359
Commit
38e27359
authored
Feb 23, 2017
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: log full level names instead of mispelled "EROR", "DBUG"
parent
e8b3e226
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
format.go
log/format.go
+3
-3
logger.go
log/logger.go
+21
-1
No files found.
log/format.go
View file @
38e27359
...
...
@@ -88,7 +88,7 @@ func TerminalFormat() Format {
}
b
:=
&
bytes
.
Buffer
{}
lvl
:=
strings
.
ToUpper
(
r
.
Lvl
.
String
()
)
lvl
:=
r
.
Lvl
.
AlignedString
(
)
if
atomic
.
LoadUint32
(
&
locationEnabled
)
!=
0
{
// Log origin printing was requested, format the location path and line number
location
:=
fmt
.
Sprintf
(
"%+v"
,
r
.
Call
)
...
...
@@ -107,13 +107,13 @@ func TerminalFormat() Format {
if
color
>
0
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m[%s|%s]%s %s "
,
color
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
location
,
padding
,
r
.
Msg
)
}
else
{
fmt
.
Fprintf
(
b
,
"
[%s]
[%s|%s]%s %s "
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
location
,
padding
,
r
.
Msg
)
fmt
.
Fprintf
(
b
,
"
%s
[%s|%s]%s %s "
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
location
,
padding
,
r
.
Msg
)
}
}
else
{
if
color
>
0
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m[%s] %s "
,
color
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
r
.
Msg
)
}
else
{
fmt
.
Fprintf
(
b
,
"
[%s]
[%s] %s "
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
r
.
Msg
)
fmt
.
Fprintf
(
b
,
"
%s
[%s] %s "
,
lvl
,
r
.
Time
.
Format
(
termTimeFormat
),
r
.
Msg
)
}
}
// try to justify the log output for short messages
...
...
log/logger.go
View file @
38e27359
...
...
@@ -24,7 +24,27 @@ const (
LvlTrace
)
// Returns the name of a Lvl
// Aligned returns a 5-character string containing the name of a Lvl.
func
(
l
Lvl
)
AlignedString
()
string
{
switch
l
{
case
LvlTrace
:
return
"TRACE"
case
LvlDebug
:
return
"DEBUG"
case
LvlInfo
:
return
"INFO "
case
LvlWarn
:
return
"WARN "
case
LvlError
:
return
"ERROR"
case
LvlCrit
:
return
"CRIT "
default
:
panic
(
"bad level"
)
}
}
// Strings returns the name of a Lvl.
func
(
l
Lvl
)
String
()
string
{
switch
l
{
case
LvlTrace
:
...
...
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