Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
72616366
Unverified
Commit
72616366
authored
7 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
Prevent inadvertently setting output from top-level sink (and so skipping filters)
Signed-off-by:
Silas Davis
<
silas@monax.io
>
parent
dfcb4c86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/burrow/main.go
+7
-0
7 additions, 0 deletions
cmd/burrow/main.go
logging/config/presets/instructions_test.go
+12
-9
12 additions, 9 deletions
logging/config/presets/instructions_test.go
with
19 additions
and
9 deletions
cmd/burrow/main.go
+
7
−
0
View file @
72616366
...
...
@@ -31,6 +31,9 @@ func main() {
burrow
.
Action
=
func
()
{
// We need to reflect on whether this obscures where values are coming from
conf
:=
config
.
DefaultBurrowConfig
()
// We treat logging a little differently in that if anything is set for logging we will not
// set default outputs
conf
.
Logging
=
nil
err
:=
source
.
EachOf
(
burrowConfigProvider
(
*
configOpt
),
source
.
FirstOf
(
...
...
@@ -38,6 +41,10 @@ func main() {
// Try working directory
genesisDocProvider
(
config
.
DefaultGenesisDocJSONFileName
,
true
)),
)
.
Apply
(
conf
)
// If no logging config was provided use the default
if
conf
.
Logging
==
nil
{
conf
.
Logging
=
logging_config
.
DefaultNodeLoggingConfig
()
}
if
err
!=
nil
{
fatalf
(
"could not obtain config: %v"
,
err
)
}
...
...
This diff is collapsed.
Click to expand it.
logging/config/presets/instructions_test.go
+
12
−
9
View file @
72616366
...
...
@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/BurntSushi/toml"
"github.com/hyperledger/burrow/logging/config"
"github.com/hyperledger/burrow/logging/loggers"
"github.com/hyperledger/burrow/logging/structure"
...
...
@@ -25,17 +24,21 @@ func TestBuildSinkConfig(t *testing.T) {
config
.
Sink
()
.
SetTransform
(
config
.
FilterTransform
(
config
.
NoFilterMode
,
structure
.
ChannelKey
,
types
.
InfoChannelName
))
.
SetOutput
(
config
.
StdoutOutput
())))
fmt
.
Println
(
config
.
JSONString
(
expectedSink
),
"
\n
"
,
config
.
JSONString
(
builtSink
))
//
fmt.Println(config.JSONString(expectedSink), "\n", config.JSONString(builtSink))
assert
.
Equal
(
t
,
config
.
JSONString
(
expectedSink
),
config
.
JSONString
(
builtSink
))
}
func
TestMinimalPreset
(
t
*
testing
.
T
)
{
builtSink
,
err
:=
BuildSinkConfig
(
Minimal
)
builtSink
,
err
:=
BuildSinkConfig
(
Minimal
,
Stderr
)
require
.
NoError
(
t
,
err
)
loggingConfig
:=
&
config
.
LoggingConfig
{
RootSink
:
builtSink
,
}
loggingConfigOut
:=
new
(
config
.
LoggingConfig
)
toml
.
Decode
(
loggingConfig
.
TOMLString
(),
loggingConfigOut
)
assert
.
Equal
(
t
,
loggingConfig
.
TOMLString
(),
loggingConfigOut
.
TOMLString
())
expectedSink
:=
config
.
Sink
()
.
AddSinks
(
config
.
Sink
()
.
SetTransform
(
config
.
PruneTransform
(
structure
.
TraceKey
,
structure
.
RunId
))
.
AddSinks
(
config
.
Sink
()
.
SetTransform
(
config
.
FilterTransform
(
config
.
IncludeWhenAllMatch
,
structure
.
ChannelKey
,
types
.
InfoChannelName
))
.
AddSinks
(
config
.
Sink
()
.
SetTransform
(
config
.
FilterTransform
(
config
.
ExcludeWhenAnyMatches
,
structure
.
ComponentKey
,
"Tendermint"
,
"module"
,
"p2p"
,
"module"
,
"mempool"
))
.
SetOutput
(
config
.
StderrOutput
()))))
//fmt.Println(config.TOMLString(expectedSink), "\n", config.TOMLString(builtSink))
assert
.
Equal
(
t
,
config
.
TOMLString
(
expectedSink
),
config
.
TOMLString
(
builtSink
))
}
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