Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
0cec8e78
Commit
0cec8e78
authored
6 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[fix] core:cli: wrongly parsed log level since migration to structopt
parent
c5c01361
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
lib/core/core/cli/mod.rs
+1
-1
1 addition, 1 deletion
lib/core/core/cli/mod.rs
lib/core/core/lib.rs
+7
-7
7 additions, 7 deletions
lib/core/core/lib.rs
with
8 additions
and
8 deletions
lib/core/core/cli/mod.rs
+
1
−
1
View file @
0cec8e78
...
@@ -41,7 +41,7 @@ pub struct DursOpt {
...
@@ -41,7 +41,7 @@ pub struct DursOpt {
profile_name
:
Option
<
String
>
,
profile_name
:
Option
<
String
>
,
#[structopt(short
=
"l"
,
long
=
"logs"
,
raw(next_line_help
=
"true"
))]
#[structopt(short
=
"l"
,
long
=
"logs"
,
raw(next_line_help
=
"true"
))]
/// Set log level. (Defaults to INFO).
/// Set log level. (Defaults to INFO).
/// Available levels: [
OFF,
ERROR, WARN, INFO, DEBUG, TRACE]
/// Available levels: [ERROR, WARN, INFO, DEBUG, TRACE]
logs_level
:
Option
<
Level
>
,
logs_level
:
Option
<
Level
>
,
#[structopt(subcommand)]
#[structopt(subcommand)]
/// CoreSubCommand
/// CoreSubCommand
...
...
This diff is collapsed.
Click to expand it.
lib/core/core/lib.rs
+
7
−
7
View file @
0cec8e78
...
@@ -711,13 +711,13 @@ pub fn init_logger(profile: &str, soft_name: &'static str, cli_args: &ArgMatches
...
@@ -711,13 +711,13 @@ pub fn init_logger(profile: &str, soft_name: &'static str, cli_args: &ArgMatches
log_file_path
.push
(
format!
(
"{}.log"
,
soft_name
));
log_file_path
.push
(
format!
(
"{}.log"
,
soft_name
));
// Get log level
// Get log level
let
log_level
=
match
cli_args
.value_of
(
"logs_level"
)
.unwrap_or
(
"
i
"
)
{
let
log_level
=
match
cli_args
.value_of
(
"logs_level"
)
.unwrap_or
(
"
INFO
"
)
{
"
e"
|
"error
"
=>
Level
::
Error
,
"
ERROR
"
=>
Level
::
Error
,
"
w"
|
"warn
"
=>
Level
::
Warn
,
"
WARN
"
=>
Level
::
Warn
,
"
i"
|
"info
"
=>
Level
::
Info
,
"
INFO
"
=>
Level
::
Info
,
"
d"
|
"debug
"
=>
Level
::
Debug
,
"
DEBUG
"
=>
Level
::
Debug
,
"
t"
|
"trace
"
=>
Level
::
Trace
,
"
TRACE
"
=>
Level
::
Trace
,
_
=>
panic!
(
"Fatal error : unknow log l
evel
!
"
),
_
=>
unreachable!
(
"Structopt guarantees us that the string match necessarily with one of the variants of the enum L
evel"
),
};
};
// Config logger
// Config logger
...
...
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