@@ -143,7 +143,7 @@ namespace pcpp
143
143
144
144
// / An enum representing the log level. Currently 4 log levels are supported: Off, Error, Info and Debug. Info is
145
145
// / the default log level
146
- enum class LogLevel
146
+ enum class LogLevel : uint8_t
147
147
{
148
148
Off = PCPP_LOG_LEVEL_OFF, // /< No log messages are emitted.
149
149
Error = PCPP_LOG_LEVEL_ERROR, // /< Error level logs are emitted.
@@ -152,9 +152,9 @@ namespace pcpp
152
152
Debug = PCPP_LOG_LEVEL_DEBUG // /< Debug level logs and above are emitted.
153
153
};
154
154
155
- inline std::ostream& operator <<(std::ostream& s , LogLevel v )
155
+ inline std::ostream& operator <<(std::ostream& ostr , LogLevel lvl )
156
156
{
157
- return s << static_cast <std::underlying_type <LogLevel>::type>(v );
157
+ return ostr << static_cast <std::underlying_type_t <LogLevel>>(lvl );
158
158
}
159
159
160
160
// Forward declaration
@@ -192,7 +192,7 @@ namespace pcpp
192
192
// / @brief Appends to the message.
193
193
// / @param value The value to append.
194
194
// / @return A reference to this context.
195
- template <class T > inline LogContext& operator <<(T const & value)
195
+ template <class T > LogContext& operator <<(T const & value)
196
196
{
197
197
m_Stream << value;
198
198
return *this ;
@@ -245,9 +245,8 @@ namespace pcpp
245
245
// / @param[in] method The method in PcapPlusPlus code the log message is coming from
246
246
// / @param[in] line The line in PcapPlusPlus code the log message is coming from
247
247
// / @remarks The printer callback should support being called from multiple threads simultaneously.
248
- using LogPrinter =
249
- std::add_pointer<void (LogLevel logLevel, const std::string& logMessage, const std::string& file,
250
- const std::string& method, const int line)>::type;
248
+ using LogPrinter = std::add_pointer_t <void (LogLevel logLevel, const std::string& logMessage,
249
+ const std::string& file, const std::string& method, const int line)>;
251
250
252
251
// / A static method for converting the log level enum to a string.
253
252
// / @param[in] logLevel A log level enum
@@ -313,7 +312,7 @@ namespace pcpp
313
312
// / @return Get the last error message
314
313
std::string getLastError () const
315
314
{
316
- std::lock_guard<std::mutex> lock (m_LastErrorMtx);
315
+ std::lock_guard<std::mutex> const lock (m_LastErrorMtx);
317
316
return m_LastError;
318
317
}
319
318
@@ -394,7 +393,7 @@ namespace pcpp
394
393
395
394
private:
396
395
bool m_LogsEnabled;
397
- std::array<LogLevel, NumOfLogModules> m_LogModulesArray;
396
+ std::array<LogLevel, NumOfLogModules> m_LogModulesArray{} ;
398
397
LogPrinter m_LogPrinter;
399
398
400
399
mutable std::mutex m_LastErrorMtx;
0 commit comments