good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
d060ae6a
Commit
d060ae6a
authored
Jun 23, 2014
by
Viktor Trón
Browse files
Options
Downloads
Patches
Plain Diff
changed logger API, functions that allow Gui to implement ethlog.LogSystem for gui logging
parent
7bcf875c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ethereal/ui/gui.go
+33
-24
33 additions, 24 deletions
ethereal/ui/gui.go
ethereal/ui/html_container.go
+2
-2
2 additions, 2 deletions
ethereal/ui/html_container.go
ethereal/ui/ui_lib.go
+3
-3
3 additions, 3 deletions
ethereal/ui/ui_lib.go
with
38 additions
and
29 deletions
ethereal/ui/gui.go
+
33
−
24
View file @
d060ae6a
...
...
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"math/big"
...
...
@@ -15,6 +16,8 @@ import (
"time"
)
var
logger
=
ethlog
.
NewLogger
(
"GUI"
)
type
Gui
struct
{
// The main application window
win
*
qml
.
Window
...
...
@@ -33,10 +36,11 @@ type Gui struct {
addr
[]
byte
pub
*
ethpub
.
PEthereum
logLevel
ethlog
.
LogLevel
}
// Create GUI, but doesn't start it
func
New
(
ethereum
*
eth
.
Ethereum
)
*
Gui
{
func
New
(
ethereum
*
eth
.
Ethereum
,
logLevel
ethlog
.
LogLevel
)
*
Gui
{
lib
:=
&
EthLib
{
stateManager
:
ethereum
.
StateManager
(),
blockChain
:
ethereum
.
BlockChain
(),
txPool
:
ethereum
.
TxPool
()}
db
,
err
:=
ethdb
.
NewLDBDatabase
(
"tx_database"
)
if
err
!=
nil
{
...
...
@@ -52,7 +56,7 @@ func New(ethereum *eth.Ethereum) *Gui {
pub
:=
ethpub
.
NewPEthereum
(
ethereum
)
return
&
Gui
{
eth
:
ethereum
,
lib
:
lib
,
txDb
:
db
,
addr
:
addr
,
pub
:
pub
}
return
&
Gui
{
eth
:
ethereum
,
lib
:
lib
,
txDb
:
db
,
addr
:
addr
,
pub
:
pub
,
logLevel
:
logLevel
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
...
...
@@ -90,16 +94,15 @@ func (gui *Gui) Start(assetPath string) {
win
,
err
=
gui
.
showKeyImport
(
context
)
}
else
{
win
,
err
=
gui
.
showWallet
(
context
)
ethutil
.
Config
.
Log
.
AddLogSystem
(
gui
)
ethlog
.
AddLogSystem
(
gui
)
}
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Infoln
(
"FATAL:
asset not found: you can set an alternative asset path on
on
the command line using option 'asset_path'"
,
err
)
logger
.
Errorln
(
"
asset not found: you can set an alternative asset path on the command line using option 'asset_path'"
,
err
)
panic
(
err
)
}
ethutil
.
Config
.
Log
.
Infoln
(
"
[GUI]
Starting GUI"
)
logger
.
Infoln
(
"Starting GUI"
)
win
.
Show
()
win
.
Wait
()
...
...
@@ -315,22 +318,6 @@ func (gui *Gui) setPeerInfo() {
}
}
// Logging functions that log directly to the GUI interface
func
(
gui
*
Gui
)
Println
(
v
...
interface
{})
{
str
:=
strings
.
TrimRight
(
fmt
.
Sprintln
(
v
...
),
"
\n
"
)
lines
:=
strings
.
Split
(
str
,
"
\n
"
)
for
_
,
line
:=
range
lines
{
gui
.
win
.
Root
()
.
Call
(
"addLog"
,
line
)
}
}
func
(
gui
*
Gui
)
Printf
(
format
string
,
v
...
interface
{})
{
str
:=
strings
.
TrimRight
(
fmt
.
Sprintf
(
format
,
v
...
),
"
\n
"
)
lines
:=
strings
.
Split
(
str
,
"
\n
"
)
for
_
,
line
:=
range
lines
{
gui
.
win
.
Root
()
.
Call
(
"addLog"
,
line
)
}
}
func
(
gui
*
Gui
)
RegisterName
(
name
string
)
{
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
name
=
fmt
.
Sprintf
(
"
\"
%s
\"\n
1"
,
name
)
...
...
@@ -357,6 +344,28 @@ func (gui *Gui) ClientId() string {
return
ethutil
.
Config
.
Identifier
}
func
(
gui
*
Gui
)
SetLogLevel
(
level
int
)
{
ethutil
.
Config
.
Log
.
SetLevel
(
level
)
// functions that allow Gui to implement interface ethlog.LogSystem
func
(
gui
*
Gui
)
SetLogLevel
(
level
ethlog
.
LogLevel
)
{
gui
.
logLevel
=
level
}
func
(
gui
*
Gui
)
GetLogLevel
()
ethlog
.
LogLevel
{
return
gui
.
logLevel
}
func
(
gui
*
Gui
)
Println
(
v
...
interface
{})
{
gui
.
printLog
(
fmt
.
Sprintln
(
v
...
))
}
func
(
gui
*
Gui
)
Printf
(
format
string
,
v
...
interface
{})
{
gui
.
printLog
(
fmt
.
Sprintf
(
format
,
v
...
))
}
// Print function that logs directly to the GUI
func
(
gui
*
Gui
)
printLog
(
s
string
)
{
str
:=
strings
.
TrimRight
(
s
,
"
\n
"
)
lines
:=
strings
.
Split
(
str
,
"
\n
"
)
for
_
,
line
:=
range
lines
{
gui
.
win
.
Root
()
.
Call
(
"addLog"
,
line
)
}
}
This diff is collapsed.
Click to expand it.
ethereal/ui/html_container.go
+
2
−
2
View file @
d060ae6a
...
...
@@ -96,11 +96,11 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) {
app
.
watcher
.
Close
()
break
out
case
<-
app
.
watcher
.
Event
:
//
ethutil.Config.Log
.Debugln("Got event:", ev)
//
logger
.Debugln("Got event:", ev)
app
.
webView
.
Call
(
"reload"
)
case
err
:=
<-
app
.
watcher
.
Error
:
// TODO: Do something here
ethutil
.
Config
.
Log
.
Infoln
(
"Watcher error:"
,
err
)
logger
.
Infoln
(
"Watcher error:"
,
err
)
}
}
}()
...
...
This diff is collapsed.
Click to expand it.
ethereal/ui/ui_lib.go
+
3
−
3
View file @
d060ae6a
...
...
@@ -40,7 +40,7 @@ func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
func
(
ui
*
UiLib
)
Open
(
path
string
)
{
component
,
err
:=
ui
.
engine
.
LoadFile
(
path
[
7
:
])
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
logger
.
Debugln
(
err
)
}
win
:=
component
.
CreateWindow
(
nil
)
...
...
@@ -60,7 +60,7 @@ func (ui *UiLib) OpenHtml(path string) {
func
(
ui
*
UiLib
)
Muted
(
content
string
)
{
component
,
err
:=
ui
.
engine
.
LoadFile
(
ui
.
AssetPath
(
"qml/muted.qml"
))
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
logger
.
Debugln
(
err
)
return
}
...
...
@@ -144,7 +144,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
script
,
err
:=
ethutil
.
Compile
(
data
)
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
logger
.
Debugln
(
err
)
return
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment