X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Filogger.h;h=d9660d4010c8a9d6ffe16256a24518b3085c35bb;hb=de270ece1b764b19968e14420f538321f1c06b15;hp=a9617ebd2adfa6aa3cfbe1f5856a09f2e5cc939e;hpb=8e3cd0a676dde4e99f88feeeccea53caeb67e5b6;p=evaf
diff --git a/src/libs/Common/ilogger.h b/src/libs/Common/ilogger.h
index a9617eb..d9660d4 100644
--- a/src/libs/Common/ilogger.h
+++ b/src/libs/Common/ilogger.h
@@ -3,7 +3,7 @@
* @brief Logger interface for eVaf
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -93,6 +93,8 @@ public:
*
* Use the setDefaultSource() function to change the default source name. If not set, then
* uses the default source name "common".
+ *
+ * Changing the name of the default source resets any other settings set for the default source.
*/
virtual void setDefaultSource(QString const & source) = 0;
@@ -100,7 +102,7 @@ public:
* Returns the current severity level
* @param source Name of the source or default if omitted.
*/
- virtual Severity severity(QString const & source = 0) = 0;
+ virtual Severity severity(QString const & source = QString()) = 0;
/**
* Changes the current severity level.
@@ -111,13 +113,13 @@ public:
* are output. With this function the severity level can be changed so that also less important
* messages are output.
*/
- virtual void setSeverity(Severity severity, QString const & source = 0) = 0;
+ virtual void setSeverity(Severity severity, QString const & source = QString()) = 0;
/**
* Returns the current maximum size of log files in KiB.
* @param source Name of the source or default if omitted.
*/
- virtual uint maxSize(QString const & source = 0) = 0;
+ virtual uint maxSize(QString const & source = QString()) = 0;
/**
* Changes the maximum size of log files for the given source
@@ -131,13 +133,13 @@ public:
*
* Set the maximum size to 0 for no limits (dangerous!).
*/
- virtual void setMaxSize(uint maxSize, QString const & source = 0) = 0;
+ virtual void setMaxSize(uint maxSize, QString const & source = QString()) = 0;
/**
* Returns the maximum number of log files.
* @param source Name of the source or default if omitted.
*/
- virtual uint maxCount(QString const & source = 0) = 0;
+ virtual uint maxCount(QString const & source = QString()) = 0;
/**
* Changes the maximum number of log files
@@ -153,7 +155,7 @@ public:
*
* Set the maximum number of log files to 0 for no limits (dangerous!).
*/
- virtual void setMaxCount(uint maxCount, QString const & source = 0) = 0;
+ virtual void setMaxCount(uint maxCount, QString const & source = QString()) = 0;
/**
* Returns the current console severity level.
@@ -188,7 +190,7 @@ public:
* Messages for the default source are also output to the console if the console severity
* level is high enough.
*/
- virtual void write(Severity severity, QString const & msg, QString const & source = 0, QString const & where = 0) = 0;
+ virtual void write(Severity severity, QString const & msg, QString const & source = QString(), QString const & where = QString()) = 0;
/**
* Helper function for formatting messages using the standard printf() function.
@@ -197,7 +199,7 @@ public:
* @return The formatted string
*/
virtual QString printf(char const * const fmt, ...) const
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
__attribute__((format(printf, 2, 3)))
#endif
= 0;
@@ -241,26 +243,13 @@ signals:
* your receiver to this signal if you want to add your own message handling. For example,
* use this signal to show messages in a log window etc.
*/
- void loggerEvent(eVaf::Common::iLogger::Severity severity, QString const & text, QString const & source, QString const & where);
+ void loggerEvent(Common::iLogger::Severity severity, QString const & text, QString const & source, QString const & where);
};
} // namespace eVaf::Common
} // namespace eVaf
-/**
- * Outputs info messages
- * @param msg The format string
- * @param ... Variable list of arguments
- *
- * The qInfo() function adds info messages to the Qt family of functions qDebug(), qWarning(), qError() and qFatal().
- */
-void COMMON_EXPORT qInfo(char const * const msg, ...)
-#ifdef Q_OS_LINUX
- __attribute__((format(printf, 1, 2)))
-#endif
-;
-
/**
* Macro for fatal error messages.
*
@@ -272,7 +261,7 @@ void COMMON_EXPORT qInfo(char const * const msg, ...)
eVaf::Common::iLogger::instance()->write( \
eVaf::Common::iLogger::Fatal, \
eVaf::Common::iLogger::instance()->printf(__VA_ARGS__), \
- 0, \
+ QString(), \
eVaf::Common::iLogger::instance()->printf("%s:%s:%d", __FILE__, __FUNCTION__, __LINE__) \
); \
} while (0)
@@ -288,7 +277,7 @@ void COMMON_EXPORT qInfo(char const * const msg, ...)
eVaf::Common::iLogger::instance()->write( \
eVaf::Common::iLogger::Error, \
eVaf::Common::iLogger::instance()->printf(__VA_ARGS__), \
- 0, \
+ QString(), \
eVaf::Common::iLogger::instance()->printf("%s:%s:%d", __FILE__, __FUNCTION__, __LINE__) \
); \
} while (0)
@@ -304,7 +293,7 @@ void COMMON_EXPORT qInfo(char const * const msg, ...)
eVaf::Common::iLogger::instance()->write( \
eVaf::Common::iLogger::Warning, \
eVaf::Common::iLogger::instance()->printf(__VA_ARGS__), \
- 0, \
+ QString(), \
eVaf::Common::iLogger::instance()->printf("%s:%s:%d", __FILE__, __FUNCTION__, __LINE__) \
); \
} while (0)
@@ -320,7 +309,7 @@ void COMMON_EXPORT qInfo(char const * const msg, ...)
eVaf::Common::iLogger::instance()->write( \
eVaf::Common::iLogger::Info, \
eVaf::Common::iLogger::instance()->printf(__VA_ARGS__), \
- 0, \
+ QString(), \
eVaf::Common::iLogger::instance()->printf("%s:%s:%d", __FILE__, __FUNCTION__, __LINE__) \
); \
} while (0)
@@ -337,7 +326,7 @@ void COMMON_EXPORT qInfo(char const * const msg, ...)
eVaf::Common::iLogger::instance()->write( \
eVaf::Common::iLogger::Debug, \
eVaf::Common::iLogger::instance()->printf(__VA_ARGS__), \
- 0, \
+ QString(), \
eVaf::Common::iLogger::instance()->printf("%s:%s:%d", __FILE__, __FUNCTION__, __LINE__) \
); \
} while (0)