Update easylogging++ from 9.96.7 to 9.97.0

Easylogging++ forgot to update the version number at the top of their
header files. Oops.
This commit is contained in:
Vasily Utkin
2021-01-01 23:28:19 +01:00
committed by username223
parent 5a7fe687d8
commit 3ab10ce334
2 changed files with 164 additions and 138 deletions
+75 -59
View File
@@ -4,13 +4,13 @@
// Easylogging++ v9.96.7
// Single-header only, cross-platform logging library for C++ applications
//
// Copyright (c) 2012-2018 Zuhd Web Services
// Copyright (c) 2012-2018 Amrayn Web Services
// Copyright (c) 2012-2018 @abumusamq
//
// This library is released under the MIT Licence.
// https://github.com/zuhd-org/easyloggingpp/blob/master/LICENSE
// https://github.com/amrayn/easyloggingpp/blob/master/LICENSE
//
// https://zuhd.org
// https://amrayn.com
// http://muflihun.com
//
@@ -119,8 +119,13 @@
#else
# define ELPP_OS_EMSCRIPTEN 0
#endif
#if (defined(__QNX__) || defined(__QNXNTO__))
# define ELPP_OS_QNX 1
#else
# define ELPP_OS_QNX 0
#endif
// Unix
#if ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_NETBSD || ELPP_OS_SOLARIS || ELPP_OS_AIX || ELPP_OS_EMSCRIPTEN) && (!ELPP_OS_WINDOWS))
#if ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_NETBSD || ELPP_OS_SOLARIS || ELPP_OS_AIX || ELPP_OS_EMSCRIPTEN || ELPP_OS_QNX) && (!ELPP_OS_WINDOWS))
# define ELPP_OS_UNIX 1
#else
# define ELPP_OS_UNIX 0
@@ -205,7 +210,7 @@ ELPP_INTERNAL_DEBUGGING_OUT_INFO << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStre
# define ELPP_INTERNAL_INFO(lvl, msg)
#endif // (defined(ELPP_DEBUG_INFO))
#if (defined(ELPP_FEATURE_ALL)) || (defined(ELPP_FEATURE_CRASH_LOG))
# if (ELPP_COMPILER_GCC && !ELPP_MINGW && !ELPP_OS_ANDROID && !ELPP_OS_EMSCRIPTEN)
# if (ELPP_COMPILER_GCC && !ELPP_MINGW && !ELPP_CYGWIN && !ELPP_OS_ANDROID && !ELPP_OS_EMSCRIPTEN && !ELPP_OS_QNX)
# define ELPP_STACKTRACE 1
# else
# if ELPP_COMPILER_MSVC
@@ -360,10 +365,10 @@ ELPP_INTERNAL_DEBUGGING_OUT_INFO << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStre
# include <codecvt>
# endif // ELPP_OS_WINDOWS
#endif // defined(ELPP_UNICODE)
#if ELPP_STACKTRACE
#ifdef HAVE_EXECINFO
# include <cxxabi.h>
# include <execinfo.h>
#endif // ELPP_STACKTRACE
#endif // ENABLE_EXECINFO
#if ELPP_OS_ANDROID
# include <sys/system_properties.h>
#endif // ELPP_OS_ANDROID
@@ -580,7 +585,7 @@ enum class Level : base::type::EnumType {
Fatal = 8,
/// @brief Information representing errors in application but application will keep running
Error = 16,
/// @brief Useful when application has potentially harmful situtaions
/// @brief Useful when application has potentially harmful situations
Warning = 32,
/// @brief Information that can be highly useful and vary with verbose logging level.
Verbose = 64,
@@ -640,7 +645,7 @@ enum class ConfigurationType : base::type::EnumType {
ToStandardOutput = 4,
/// @brief Determines format of logging corresponding level and logger.
Format = 8,
/// @brief Determines log file (full path) to write logs to for correponding level and logger
/// @brief Determines log file (full path) to write logs to for corresponding level and logger
Filename = 16,
/// @brief Specifies precision of the subsecond part. It should be within range (1-6).
SubsecondPrecision = 32,
@@ -671,7 +676,7 @@ class ConfigurationTypeHelper : base::StaticClass {
static base::type::EnumType castToInt(ConfigurationType configurationType) {
return static_cast<base::type::EnumType>(configurationType);
}
/// @brief Casts int(ushort) to configurationt type, useful for iterating through enum.
/// @brief Casts int(ushort) to configuration type, useful for iterating through enum.
static ConfigurationType castFromInt(base::type::EnumType c) {
return static_cast<ConfigurationType>(c);
}
@@ -700,7 +705,7 @@ enum class LoggingFlag : base::type::EnumType {
LogDetailedCrashReason = 4,
/// @brief Allows to disable application abortion when logged using FATAL level
DisableApplicationAbortOnFatalLog = 8,
/// @brief Flushes log with every log-entry (performance sensative) - Disabled by default
/// @brief Flushes log with every log-entry (performance sensitive) - Disabled by default
ImmediateFlush = 16,
/// @brief Enables strict file rolling
StrictLogFileSizeCheck = 32,
@@ -753,9 +758,9 @@ static const char* kSysLogLoggerId = "syslog";
#endif // defined(ELPP_SYSLOG)
#if ELPP_OS_WINDOWS
static const char* kFilePathSeperator = "\\";
static const char* kFilePathSeparator = "\\";
#else
static const char* kFilePathSeperator = "/";
static const char* kFilePathSeparator = "/";
#endif // ELPP_OS_WINDOWS
static const std::size_t kSourceFilenameMaxLength = 100;
@@ -765,12 +770,12 @@ const struct {
double value;
const base::type::char_t* unit;
} kTimeFormats[] = {
{ 1000.0f, ELPP_LITERAL("us") },
{ 1000.0f, ELPP_LITERAL("ms") },
{ 60.0f, ELPP_LITERAL("seconds") },
{ 60.0f, ELPP_LITERAL("minutes") },
{ 24.0f, ELPP_LITERAL("hours") },
{ 7.0f, ELPP_LITERAL("days") }
{ 1000.0, ELPP_LITERAL("us") },
{ 1000.0, ELPP_LITERAL("ms") },
{ 60.0, ELPP_LITERAL("seconds") },
{ 60.0, ELPP_LITERAL("minutes") },
{ 24.0, ELPP_LITERAL("hours") },
{ 7.0, ELPP_LITERAL("days") }
};
static const int kTimeFormatsCount = sizeof(kTimeFormats) / sizeof(kTimeFormats[0]);
const struct {
@@ -786,7 +791,7 @@ const struct {
},
{
SIGFPE, "SIGFPE", "Erroneous arithmetic operation",
"Arithemetic operation issue such as division by zero or operation resulting in overflow."
"Arithmetic operation issue such as division by zero or operation resulting in overflow."
},
{
SIGILL, "SIGILL", "Illegal instruction",
@@ -1052,14 +1057,14 @@ class File : base::StaticClass {
static bool createPath(const std::string& path);
/// @brief Extracts path of filename with leading slash
static std::string extractPathFromFilename(const std::string& fullPath,
const char* seperator = base::consts::kFilePathSeperator);
const char* separator = base::consts::kFilePathSeparator);
/// @brief builds stripped filename and puts it in buff
static void buildStrippedFilename(const char* filename, char buff[],
std::size_t limit = base::consts::kSourceFilenameMaxLength);
/// @brief builds base filename and puts it in buff
static void buildBaseFilename(const std::string& fullPath, char buff[],
std::size_t limit = base::consts::kSourceFilenameMaxLength,
const char* seperator = base::consts::kFilePathSeperator);
const char* separator = base::consts::kFilePathSeparator);
};
/// @brief String utilities helper class used internally. You should not use it.
class Str : base::StaticClass {
@@ -1128,7 +1133,7 @@ class Str : base::StaticClass {
static char* addToBuff(const char* str, char* buf, const char* bufLim);
static char* clearBuff(char buff[], std::size_t lim);
/// @brief Converst wchar* to char*
/// @brief Converts wchar* to char*
/// NOTE: Need to free return value after use!
static char* wcharPtrToCharPtr(const wchar_t* line);
};
@@ -1169,7 +1174,7 @@ class OS : base::StaticClass {
/// @brief Gets current host name or computer name.
///
/// @detail For android systems this is device name with its manufacturer and model seperated by hyphen
/// @detail For android systems this is device name with its manufacturer and model separated by hyphen
static std::string currentHost(void);
/// @brief Whether or not terminal supports colors
static bool termSupportsColor(void);
@@ -1179,7 +1184,7 @@ class DateTime : base::StaticClass {
public:
/// @brief Cross platform gettimeofday for Windows and unix platform. This can be used to determine current microsecond.
///
/// @detail For unix system it uses gettimeofday(timeval*, timezone*) and for Windows, a seperate implementation is provided
/// @detail For unix system it uses gettimeofday(timeval*, timezone*) and for Windows, a separate implementation is provided
/// @param [in,out] tv Pointer that gets updated
static void gettimeofday(struct timeval* tv);
@@ -1225,7 +1230,7 @@ class CommandLineArgs {
}
/// @brief Sets arguments and parses them
void setArgs(int argc, char** argv);
/// @brief Returns true if arguments contain paramKey with a value (seperated by '=')
/// @brief Returns true if arguments contain paramKey with a value (separated by '=')
bool hasParamWithValue(const char* paramKey) const;
/// @brief Returns value of arguments
/// @see hasParamWithValue(const char*)
@@ -1381,7 +1386,7 @@ class Registry : public AbstractRegistry<T_Ptr, std::unordered_map<T_Key, T_Ptr*
this->reinitDeepCopy(sr);
}
/// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element
/// @brief Assignment operator that unregisters all the existing registries and deeply copies each of repo element
/// @see unregisterAll()
/// @see deepCopy(const AbstractRegistry&)
Registry& operator=(const Registry& sr) {
@@ -1462,7 +1467,7 @@ class RegistryWithPred : public AbstractRegistry<T_Ptr, std::vector<T_Ptr*>> {
this->reinitDeepCopy(sr);
}
/// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element
/// @brief Assignment operator that unregisters all the existing registries and deeply copies each of repo element
/// @see unregisterAll()
/// @see deepCopy(const AbstractRegistry&)
RegistryWithPred& operator=(const RegistryWithPred& sr) {
@@ -1509,7 +1514,7 @@ class RegistryWithPred : public AbstractRegistry<T_Ptr, std::vector<T_Ptr*>> {
this->list().push_back(ptr);
}
/// @brief Gets pointer from repository with speicifed arguments. Arguments are passed to predicate
/// @brief Gets pointer from repository with specified arguments. Arguments are passed to predicate
/// in order to validate pointer.
template <typename T, typename T2>
T_Ptr* get(const T& arg1, const T2 arg2) {
@@ -1893,6 +1898,7 @@ class Configurations : public base::utils::RegistryWithPred<Configuration, Confi
namespace base {
typedef std::shared_ptr<base::type::fstream_t> FileStreamPtr;
typedef std::unordered_map<std::string, FileStreamPtr> LogStreamsReferenceMap;
typedef std::shared_ptr<base::LogStreamsReferenceMap> LogStreamsReferenceMapPtr;
/// @brief Configurations with data types.
///
/// @detail el::Configurations have string based values. This is whats used internally in order to read correct configurations.
@@ -1904,7 +1910,7 @@ class TypedConfigurations : public base::threading::ThreadSafe {
/// @brief Constructor to initialize (construct) the object off el::Configurations
/// @param configurations Configurations pointer/reference to base this typed configurations off.
/// @param logStreamsReference Use ELPP->registeredLoggers()->logStreamsReference()
TypedConfigurations(Configurations* configurations, base::LogStreamsReferenceMap* logStreamsReference);
TypedConfigurations(Configurations* configurations, LogStreamsReferenceMapPtr logStreamsReference);
TypedConfigurations(const TypedConfigurations& other);
@@ -1939,7 +1945,7 @@ class TypedConfigurations : public base::threading::ThreadSafe {
std::unordered_map<Level, base::FileStreamPtr> m_fileStreamMap;
std::unordered_map<Level, std::size_t> m_maxLogFileSizeMap;
std::unordered_map<Level, std::size_t> m_logFlushThresholdMap;
base::LogStreamsReferenceMap* m_logStreamsReference;
LogStreamsReferenceMapPtr m_logStreamsReference = nullptr;
friend class el::Helpers;
friend class el::base::MessageBuilder;
@@ -2207,11 +2213,11 @@ class LogBuilder : base::NoCopy {
typedef std::shared_ptr<LogBuilder> LogBuilderPtr;
/// @brief Represents a logger holding ID and configurations we need to write logs
///
/// @detail This class does not write logs itself instead its used by writer to read configuations from.
/// @detail This class does not write logs itself instead its used by writer to read configurations from.
class Logger : public base::threading::ThreadSafe, public Loggable {
public:
Logger(const std::string& id, base::LogStreamsReferenceMap* logStreamsReference);
Logger(const std::string& id, const Configurations& configurations, base::LogStreamsReferenceMap* logStreamsReference);
Logger(const std::string& id, base::LogStreamsReferenceMapPtr logStreamsReference);
Logger(const std::string& id, const Configurations& configurations, base::LogStreamsReferenceMapPtr logStreamsReference);
Logger(const Logger& logger);
Logger& operator=(const Logger& logger);
@@ -2257,7 +2263,16 @@ class Logger : public base::threading::ThreadSafe, public Loggable {
void flush(Level level, base::type::fstream_t* fs);
inline bool isFlushNeeded(Level level) {
//If GCC, errors on MSVC.
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnull-dereference"
#endif
// Causes an error on GCC.
return ++m_unflushedCount.find(level)->second >= m_typedConfigurations->logFlushThreshold(level);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
inline LogBuilder* logBuilder(void) const {
@@ -2301,7 +2316,7 @@ inline void FUNCTION_NAME(const T&);
bool m_isConfigured;
Configurations m_configurations;
std::unordered_map<Level, unsigned int> m_unflushedCount;
base::LogStreamsReferenceMap* m_logStreamsReference;
base::LogStreamsReferenceMapPtr m_logStreamsReference = nullptr;
LogBuilderPtr m_logBuilder;
friend class el::LogMessage;
@@ -2388,8 +2403,8 @@ class RegisteredLoggers : public base::utils::Registry<Logger, std::string> {
base::utils::Registry<Logger, std::string>::unregister(logger->id());
}
inline base::LogStreamsReferenceMap* logStreamsReference(void) {
return &m_logStreamsReference;
inline LogStreamsReferenceMapPtr logStreamsReference(void) {
return m_logStreamsReference;
}
inline void flushAll(void) {
@@ -2405,7 +2420,7 @@ class RegisteredLoggers : public base::utils::Registry<Logger, std::string> {
private:
LogBuilderPtr m_defaultLogBuilder;
Configurations m_defaultConfigurations;
base::LogStreamsReferenceMap m_logStreamsReference;
base::LogStreamsReferenceMapPtr m_logStreamsReference = nullptr;
std::unordered_map<std::string, base::type::LoggerRegistrationCallbackPtr> m_loggerRegistrationCallbacks;
friend class el::base::Storage;
@@ -2859,7 +2874,7 @@ class IterableStack : public IterableContainer<T, Container>, public std::stack<
// Log message builder
class MessageBuilder {
public:
MessageBuilder(void) : m_logger(nullptr), m_containerLogSeperator(ELPP_LITERAL("")) {}
MessageBuilder(void) : m_logger(nullptr), m_containerLogSeparator(ELPP_LITERAL("")) {}
void initialize(Logger* logger);
# define ELPP_SIMPLE_LOG(LOG_TYPE)\
@@ -3047,7 +3062,7 @@ return writeIterator(template_inst.begin(), template_inst.end(), template_inst.s
m_logger->stream() << ELPP_LITERAL(", ");
operator << (static_cast<V>(map_.value(*begin)));
m_logger->stream() << ELPP_LITERAL(")");
m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeperator : ELPP_LITERAL(""));
m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeparator : ELPP_LITERAL(""));
}
if (begin != end) {
m_logger->stream() << ELPP_LITERAL("...");
@@ -3073,7 +3088,7 @@ return writeIterator(template_inst.begin(), template_inst.end(), template_inst.s
m_logger->stream() << ELPP_LITERAL(", ");
operator << (static_cast<V>(hash_.value(*begin)));
m_logger->stream() << ELPP_LITERAL(")");
m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeperator : ELPP_LITERAL(""));
m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeparator : ELPP_LITERAL(""));
}
if (begin != end) {
m_logger->stream() << ELPP_LITERAL("...");
@@ -3104,7 +3119,7 @@ return writeIterator(template_inst.begin(), template_inst.end(), template_inst.s
/// have begin() and end() methods that return respective iterators
/// @param ContainerType Type of container e.g, MyList from WX_DECLARE_LIST(int, MyList); in wxwidgets
/// @param SizeMethod Method used to get size of container.
/// @param ElementInstance Instance of element to be fed out. Insance name is "elem". See WXELPP_ENABLED macro
/// @param ElementInstance Instance of element to be fed out. Instance name is "elem". See WXELPP_ENABLED macro
/// for an example usage
#define MAKE_CONTAINERELPP_FRIENDLY(ContainerType, SizeMethod, ElementInstance) \
el::base::type::ostream_t& operator<<(el::base::type::ostream_t& ss, const ContainerType& container) {\
@@ -3146,14 +3161,14 @@ ELPP_LITERAL("(") << elem->first << ELPP_LITERAL(", ") << elem->second << ELPP_L
#undef ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG
private:
Logger* m_logger;
const base::type::char_t* m_containerLogSeperator;
const base::type::char_t* m_containerLogSeparator;
template<class Iterator>
MessageBuilder& writeIterator(Iterator begin_, Iterator end_, std::size_t size_) {
m_logger->stream() << ELPP_LITERAL("[");
for (std::size_t i = 0; begin_ != end_ && i < base::consts::kMaxLogPerContainer; ++i, ++begin_) {
operator << (*begin_);
m_logger->stream() << ((i < size_ - 1) ? m_containerLogSeperator : ELPP_LITERAL(""));
m_logger->stream() << ((i < size_ - 1) ? m_containerLogSeparator : ELPP_LITERAL(""));
}
if (begin_ != end_) {
m_logger->stream() << ELPP_LITERAL("...");
@@ -3260,7 +3275,7 @@ class PErrorWriter : public base::Writer {
// Logging from Logger class. Why this is here? Because we have Storage and Writer class available
#if ELPP_VARIADIC_TEMPLATES_SUPPORTED
template <typename T, typename... Args>
void Logger::log_(Level level, int vlevel, const char* s, const T& value, const Args&... args) {
void Logger::log_(Level varlevel, int vlevel, const char* s, const T& value, const Args&... args) {
base::MessageBuilder b;
b.initialize(this);
while (*s) {
@@ -3271,7 +3286,7 @@ void Logger::log_(Level level, int vlevel, const char* s, const T& value, const
if (*(s + 1) == base::consts::kFormatSpecifierCharValue) {
++s;
b << value;
log_(level, vlevel, ++s, args...);
log_(varlevel, vlevel, ++s, args...);
return;
}
}
@@ -3281,28 +3296,28 @@ void Logger::log_(Level level, int vlevel, const char* s, const T& value, const
ELPP_INTERNAL_ERROR("Too many arguments provided. Unable to handle. Please provide more format specifiers", false);
}
template <typename T>
void Logger::log_(Level level, int vlevel, const T& log) {
if (level == Level::Verbose) {
if (ELPP->vRegistry()->allowed(vlevel, __FILE__)) {
void Logger::log_(Level varlevel, int vlevel, const T& vlog) {
if (varlevel == Level::Verbose) {
if (ELPP->vRegistry()->allowed(static_cast<base::type::VerboseLevel>(vlevel), __FILE__)) {
base::Writer(Level::Verbose, "FILE", 0, "FUNCTION",
base::DispatchAction::NormalLog, vlevel).construct(this, false) << log;
base::DispatchAction::NormalLog, vlevel).construct(this, false) << vlog;
} else {
stream().str(ELPP_LITERAL(""));
releaseLock();
}
} else {
base::Writer(level, "FILE", 0, "FUNCTION").construct(this, false) << log;
base::Writer(varlevel, "FILE", 0, "FUNCTION").construct(this, false) << vlog;
}
}
template <typename T, typename... Args>
inline void Logger::log(Level level, const char* s, const T& value, const Args&... args) {
inline void Logger::log(Level varlevel, const char* s, const T& value, const Args&... args) {
acquireLock(); // released in Writer!
log_(level, 0, s, value, args...);
log_(varlevel, 0, s, value, args...);
}
template <typename T>
inline void Logger::log(Level level, const T& log) {
inline void Logger::log(Level varlevel, const T& vlog) {
acquireLock(); // released in Writer!
log_(level, 0, log);
log_(varlevel, 0, vlog);
}
# if ELPP_VERBOSE_LOG
template <typename T, typename... Args>
@@ -3311,9 +3326,9 @@ inline void Logger::verbose(int vlevel, const char* s, const T& value, const Arg
log_(el::Level::Verbose, vlevel, s, value, args...);
}
template <typename T>
inline void Logger::verbose(int vlevel, const T& log) {
inline void Logger::verbose(int vlevel, const T& vlog) {
acquireLock(); // released in Writer!
log_(el::Level::Verbose, vlevel, log);
log_(el::Level::Verbose, vlevel, vlog);
}
# else
template <typename T, typename... Args>
@@ -3632,6 +3647,7 @@ class SysLogInitializer {
public:
SysLogInitializer(const char* processIdent, int options = 0, int facility = 0) {
#if defined(ELPP_SYSLOG)
(void)base::consts::kSysLogLoggerId;
openlog(processIdent, options, facility);
#else
ELPP_UNUSED(processIdent);
@@ -3824,7 +3840,7 @@ class Loggers : base::StaticClass {
/// @brief Returns current default
static const Configurations* defaultConfigurations(void);
/// @brief Returns log stream reference pointer if needed by user
static const base::LogStreamsReferenceMap* logStreamsReference(void);
static const base::LogStreamsReferenceMapPtr logStreamsReference(void);
/// @brief Default typed configuration based on existing defaultConf
static base::TypedConfigurations defaultTypedConfigurations(void);
/// @brief Populates all logger IDs in current repository.
@@ -3835,7 +3851,7 @@ class Loggers : base::StaticClass {
/// @brief Configures loggers using command line arg. Ensure you have already set command line args,
/// @return False if invalid argument or argument with no value provided, true if attempted to configure logger.
/// If true is returned that does not mean it has been configured successfully, it only means that it
/// has attempeted to configure logger using configuration file provided in argument
/// has attempted to configure logger using configuration file provided in argument
static bool configureFromArg(const char* argKey);
/// @brief Flushes all loggers for all levels - Be careful if you dont know how many loggers are registered
static void flushAll(void);