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
a5414298
Commit
a5414298
authored
May 20, 2019
by
Nikifor Seryakov
Committed by
Péter Szilágyi
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: do not pad values longer than 40 characters (#19592)
* log: Do not pad too long values * log: gofmt
parent
4cf8505d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
format.go
log/format.go
+7
-6
No files found.
log/format.go
View file @
a5414298
...
...
@@ -14,10 +14,11 @@ import (
)
const
(
timeFormat
=
"2006-01-02T15:04:05-0700"
termTimeFormat
=
"01-02|15:04:05.000"
floatFormat
=
'f'
termMsgJust
=
40
timeFormat
=
"2006-01-02T15:04:05-0700"
termTimeFormat
=
"01-02|15:04:05.000"
floatFormat
=
'f'
termMsgJust
=
40
termCtxMaxPadding
=
40
)
// locationTrims are trimmed for display to avoid unwieldy log lines.
...
...
@@ -175,7 +176,7 @@ func logfmt(buf *bytes.Buffer, ctx []interface{}, color int, term bool) {
fieldPaddingLock
.
RUnlock
()
length
:=
utf8
.
RuneCountInString
(
v
)
if
padding
<
length
{
if
padding
<
length
&&
length
<=
termCtxMaxPadding
{
padding
=
length
fieldPaddingLock
.
Lock
()
...
...
@@ -189,7 +190,7 @@ func logfmt(buf *bytes.Buffer, ctx []interface{}, color int, term bool) {
buf
.
WriteByte
(
'='
)
}
buf
.
WriteString
(
v
)
if
i
<
len
(
ctx
)
-
2
{
if
i
<
len
(
ctx
)
-
2
&&
padding
>
length
{
buf
.
Write
(
bytes
.
Repeat
([]
byte
{
' '
},
padding
-
length
))
}
}
...
...
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