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
a7ad9c30
Commit
a7ad9c30
authored
10 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into conversion
parents
ce862ee7
38c7c589
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
7 deletions
+32
-7
main.go
cmd/ethereum/main.go
+2
-2
log.go
logger/log.go
+2
-0
logsystem.go
logger/logsystem.go
+24
-0
sys.go
logger/sys.go
+1
-2
node.go
p2p/discover/node.go
+2
-2
message.go
p2p/message.go
+1
-1
No files found.
cmd/ethereum/main.go
View file @
a7ad9c30
...
...
@@ -251,7 +251,7 @@ func accountList(ctx *cli.Context) {
utils
.
Fatalf
(
"Could not list accounts: %v"
,
err
)
}
for
_
,
acct
:=
range
accts
{
fmt
.
Printf
(
"Address: %
#
x
\n
"
,
acct
)
fmt
.
Printf
(
"Address: %x
\n
"
,
acct
)
}
}
...
...
@@ -278,7 +278,7 @@ func accountCreate(ctx *cli.Context) {
if
err
!=
nil
{
utils
.
Fatalf
(
"Could not create the account: %v"
,
err
)
}
fmt
.
Printf
(
"Address: %
#
x
\n
"
,
acct
.
Address
)
fmt
.
Printf
(
"Address: %x
\n
"
,
acct
.
Address
)
}
func
importchain
(
ctx
*
cli
.
Context
)
{
...
...
This diff is collapsed.
Click to expand it.
logger/log.go
View file @
a7ad9c30
...
...
@@ -30,6 +30,8 @@ func New(datadir string, logFile string, logLevel int, logFormat string) LogSyst
switch
logFormat
{
case
"raw"
:
sys
=
NewRawLogSystem
(
writer
,
0
,
LogLevel
(
logLevel
))
case
"json"
:
sys
=
NewJsonLogSystem
(
writer
,
0
,
LogLevel
(
logLevel
))
default
:
sys
=
NewStdLogSystem
(
writer
,
log
.
LstdFlags
,
LogLevel
(
logLevel
))
}
...
...
This diff is collapsed.
Click to expand it.
logger/logsystem.go
View file @
a7ad9c30
...
...
@@ -61,3 +61,27 @@ func (t *rawLogSystem) SetLogLevel(i LogLevel) {
func
(
t
*
rawLogSystem
)
GetLogLevel
()
LogLevel
{
return
LogLevel
(
atomic
.
LoadUint32
(
&
t
.
level
))
}
// NewRawLogSystem creates a LogSystem that prints to the given writer without
// adding extra information. Suitable for preformatted output
func
NewJsonLogSystem
(
writer
io
.
Writer
,
flags
int
,
level
LogLevel
)
LogSystem
{
logger
:=
log
.
New
(
writer
,
""
,
0
)
return
&
jsonLogSystem
{
logger
,
uint32
(
level
)}
}
type
jsonLogSystem
struct
{
logger
*
log
.
Logger
level
uint32
}
func
(
t
*
jsonLogSystem
)
LogPrint
(
level
LogLevel
,
msg
string
)
{
t
.
logger
.
Print
(
msg
)
}
func
(
t
*
jsonLogSystem
)
SetLogLevel
(
i
LogLevel
)
{
atomic
.
StoreUint32
(
&
t
.
level
,
uint32
(
i
))
}
func
(
t
*
jsonLogSystem
)
GetLogLevel
()
LogLevel
{
return
LogLevel
(
atomic
.
LoadUint32
(
&
t
.
level
))
}
This diff is collapsed.
Click to expand it.
logger/sys.go
View file @
a7ad9c30
...
...
@@ -76,8 +76,7 @@ func dispatchLoop() {
func
sysLoop
(
sys
LogSystem
,
in
<-
chan
message
,
wg
*
sync
.
WaitGroup
)
{
for
msg
:=
range
in
{
switch
sys
.
(
type
)
{
case
*
rawLogSystem
:
// This is a semantic hack since rawLogSystem has little to do with JsonLevel
case
*
jsonLogSystem
:
if
msg
.
level
==
JsonLevel
{
sys
.
LogPrint
(
msg
.
level
,
msg
.
msg
)
}
...
...
This diff is collapsed.
Click to expand it.
p2p/discover/node.go
View file @
a7ad9c30
...
...
@@ -143,12 +143,12 @@ type NodeID [nodeIDBits / 8]byte
// NodeID prints as a long hexadecimal number.
func
(
n
NodeID
)
String
()
string
{
return
fmt
.
Sprintf
(
"%
#
x"
,
n
[
:
])
return
fmt
.
Sprintf
(
"%x"
,
n
[
:
])
}
// The Go syntax representation of a NodeID is a call to HexID.
func
(
n
NodeID
)
GoString
()
string
{
return
fmt
.
Sprintf
(
"discover.HexID(
\"
%
#
x
\"
)"
,
n
[
:
])
return
fmt
.
Sprintf
(
"discover.HexID(
\"
%x
\"
)"
,
n
[
:
])
}
// HexID converts a hex string to a NodeID.
...
...
This diff is collapsed.
Click to expand it.
p2p/message.go
View file @
a7ad9c30
...
...
@@ -33,7 +33,7 @@ type Msg struct {
// For the decoding rules, please see package rlp.
func
(
msg
Msg
)
Decode
(
val
interface
{})
error
{
if
err
:=
rlp
.
Decode
(
msg
.
Payload
,
val
);
err
!=
nil
{
return
newPeerError
(
errInvalidMsg
,
"(code %
#
x) (size %d) %v"
,
msg
.
Code
,
msg
.
Size
,
err
)
return
newPeerError
(
errInvalidMsg
,
"(code %x) (size %d) %v"
,
msg
.
Code
,
msg
.
Size
,
err
)
}
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
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