Skip to content

Commit 23a608a

Browse files
committed
Core/Logging: fixed log level range check in Log::SetLogLevel
1 parent 81c6172 commit 23a608a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/Logging/Log.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,12 @@ std::string Log::GetTimestampStr()
262262

263263
bool Log::SetLogLevel(std::string const& name, char const* newLevelc, bool isLogger /* = true */)
264264
{
265-
LogLevel newLevel = LogLevel(atoi(newLevelc));
266-
if (static_cast<int>(newLevel) < 0)
265+
int32 newLeveli = atoi(newLevelc);
266+
if (newLeveli < 0)
267267
return false;
268268

269+
LogLevel newLevel = static_cast<LogLevel>(newLeveli);
270+
269271
if (isLogger)
270272
{
271273
auto it = loggers.begin();

0 commit comments

Comments
 (0)