Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLAScommon
Commits
ceccbb60
Commit
ceccbb60
authored
Nov 01, 2018
by
Steffen Vogel
🎅🏼
Browse files
log: throw exception for unknown log levels
parent
8de147f0
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/log.cpp
View file @
ceccbb60
...
...
@@ -20,6 +20,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include
<list>
#include
<algorithm>
#include
<spdlog/sinks/stdout_color_sinks.h>
#include
<spdlog/sinks/syslog_sink.h>
#include
<spdlog/sinks/basic_file_sink.h>
...
...
@@ -138,7 +141,13 @@ void Log::setLevel(Level lvl)
void
Log
::
setLevel
(
const
std
::
string
&
lvl
)
{
auto
level
=
spdlog
::
level
::
from_str
(
lvl
);
std
::
list
<
std
::
string
>
l
=
SPDLOG_LEVEL_NAMES
;
auto
it
=
std
::
find
(
l
.
begin
(),
l
.
end
(),
lvl
);
if
(
it
==
l
.
end
())
throw
RuntimeError
(
"Invalid log level {}"
,
lvl
);
level
=
spdlog
::
level
::
from_str
(
lvl
);
setLevel
(
level
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment