Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Logging
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
libraries
Logging
Commits
e8279ae4
Commit
e8279ae4
authored
5 years ago
by
Benedikt Heinrichs
Browse files
Options
Downloads
Patches
Plain Diff
New: Add the option to supply a default value (coscine/issues#741)
parent
49b9b60b
No related branches found
No related tags found
2 merge requests
!9
Product/574-configDefault
,
!8
New: Add the option to supply a default value
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Logging/CoscineLogger.cs
+25
-12
25 additions, 12 deletions
src/Logging/CoscineLogger.cs
with
25 additions
and
12 deletions
src/Logging/CoscineLogger.cs
+
25
−
12
View file @
e8279ae4
...
...
@@ -350,13 +350,13 @@ namespace Coscine.Logging
private
static
void
UpdateActiveLogs
()
{
activeLoglevels
[(
int
)
LogType
.
Debug
]
=
!
GetStringFromConsul
(
LogLevelKeyDebug
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Low
]
=
!
GetStringFromConsul
(
LogLevelKeyLow
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Medium
]
=
!
GetStringFromConsul
(
LogLevelKeyMedium
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
High
]
=
!
GetStringFromConsul
(
LogLevelKeyHigh
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Critical
]
=
!
GetStringFromConsul
(
LogLevelKeyCritical
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Analytics
]
=
!
GetStringFromConsul
(
LogLevelKeyAnalytics
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Reporting
]
=
!
GetStringFromConsul
(
LogLevelKeyReporting
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Debug
]
=
!
GetStringFromConsul
(
LogLevelKeyDebug
,
"0"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Low
]
=
!
GetStringFromConsul
(
LogLevelKeyLow
,
"0"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Medium
]
=
!
GetStringFromConsul
(
LogLevelKeyMedium
,
"0"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
High
]
=
!
GetStringFromConsul
(
LogLevelKeyHigh
,
"1"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Critical
]
=
!
GetStringFromConsul
(
LogLevelKeyCritical
,
"1"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Analytics
]
=
!
GetStringFromConsul
(
LogLevelKeyAnalytics
,
"0"
).
Equals
(
"0"
);
activeLoglevels
[(
int
)
LogType
.
Reporting
]
=
!
GetStringFromConsul
(
LogLevelKeyReporting
,
"0"
).
Equals
(
"0"
);
var
config
=
LogManager
.
Configuration
;
config
.
FindRuleByName
(
"blockAllInformation"
).
Final
=
!
activeLoglevels
[(
int
)
LogType
.
Analytics
]
&&
!
activeLoglevels
[(
int
)
LogType
.
Reporting
];
...
...
@@ -392,15 +392,28 @@ namespace Coscine.Logging
getPair
.
Wait
();
var
returnValue
=
getPair
.
Result
.
Response
.
Value
;
if
(
returnValue
!=
null
)
if
(
getPair
.
Result
.
Response
?.
Value
!=
null
)
{
return
Encoding
.
UTF8
.
GetString
(
returnValue
,
0
,
returnValue
.
Length
);
var
value
=
getPair
.
Result
.
Response
.
Value
;
return
Encoding
.
UTF8
.
GetString
(
value
,
0
,
value
.
Length
);
}
else
{
// TODO: Add logging that key has not been found
return
null
;
}
}
}
private
static
string
GetStringFromConsul
(
string
key
,
string
defaultValue
)
{
var
value
=
GetStringFromConsul
(
key
);
if
(
value
==
null
)
{
// TODO: Add logging that default value has been used
return
defaultValue
;
}
return
value
;
}
}
}
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