Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
elixxir
client
Commits
49e119bd
Commit
49e119bd
authored
Feb 26, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
fixed the log level flags
parent
7cc1a664
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+2
-1
2 additions, 1 deletion
README.md
cmd/root.go
+8
-6
8 additions, 6 deletions
cmd/root.go
with
10 additions
and
7 deletions
README.md
+
2
−
1
View file @
49e119bd
...
...
@@ -182,7 +182,8 @@ Flags:
--unsafe-channel-creation Turns off the user identity authenticated
channel check, automatically approving
authenticated channels
-v, --verbose Verbose mode for debugging
-v, --logLevel Level of debugging to print (0 = info,
1 = debug, >1 = trace). (Default info)
--waitTimeout uint The number of seconds to wait for messages to
arrive (default 15)
-w, --writeContact string Write the contact file for this user to this
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
8
−
6
View file @
49e119bd
...
...
@@ -260,7 +260,7 @@ func printRoundResults(allRoundsSucceeded, timedOut bool,
}
func
createClient
()
*
api
.
Client
{
initLog
(
viper
.
Get
Bool
(
"verbose
"
),
viper
.
GetString
(
"log"
))
initLog
(
viper
.
Get
Uint
(
"logLevel
"
),
viper
.
GetString
(
"log"
))
jww
.
INFO
.
Printf
(
Version
())
pass
:=
viper
.
GetString
(
"password"
)
...
...
@@ -547,7 +547,7 @@ func getUIDFromString(idStr string) *id.ID {
return
ID
}
func
initLog
(
verbose
bool
,
logPath
string
)
{
func
initLog
(
threshold
uint
,
logPath
string
)
{
if
logPath
!=
"-"
&&
logPath
!=
""
{
// Disable stdout output
jww
.
SetStdoutOutput
(
ioutil
.
Discard
)
...
...
@@ -560,14 +560,16 @@ func initLog(verbose bool, logPath string) {
jww
.
SetLogOutput
(
logOutput
)
}
if
verbose
{
if
threshold
>
1
{
jww
.
SetStdoutThreshold
(
jww
.
LevelTrace
)
jww
.
SetLogThreshold
(
jww
.
LevelTrace
)
}
else
if
threshold
==
1
{
jww
.
SetStdoutThreshold
(
jww
.
LevelDebug
)
jww
.
SetLogThreshold
(
jww
.
LevelDebug
)
}
else
{
jww
.
SetStdoutThreshold
(
jww
.
LevelInfo
)
jww
.
SetLogThreshold
(
jww
.
LevelInfo
)
}
}
func
isValidUser
(
usr
[]
byte
)
(
bool
,
*
id
.
ID
)
{
...
...
@@ -615,7 +617,7 @@ func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
rootCmd
.
PersistentFlags
()
.
BoolP
(
"verbose
"
,
"v"
,
false
,
rootCmd
.
PersistentFlags
()
.
UintP
(
"logLevel
"
,
"v"
,
0
,
"Verbose mode for debugging"
)
viper
.
BindPFlag
(
"verbose"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"verbose"
))
...
...
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