Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade #40

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)


SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down Expand Up @@ -40,7 +41,13 @@ ENDIF(WIN32)

SET(library_target CuteLogger)

ADD_LIBRARY(${library_target} SHARED ${sources} ${includes})
OPTION( CuteLogger_STATIC "Use CuteLogger Static" OFF )
IF ( CuteLogger_STATIC )
ADD_LIBRARY(${library_target} STATIC ${sources} ${includes})
ELSE()
ADD_LIBRARY(${library_target} SHARED ${sources} ${includes})
ENDIF()

TARGET_LINK_LIBRARIES(${library_target} Qt5::Core)
TARGET_INCLUDE_DIRECTORIES(${library_target} PUBLIC include)

Expand Down
4 changes: 2 additions & 2 deletions include/AbstractAppender.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class CUTELOGGERSHARED_EXPORT AbstractAppender
const char* function, const QString& category, const QString& message) = 0;

private:
QMutex m_writeMutex;
QMutex m_writeMutex{};

Logger::LogLevel m_detailsLevel;
mutable QMutex m_detailsLevelMutex;
mutable QMutex m_detailsLevelMutex{};
};

#endif // ABSTRACTAPPENDER_H
4 changes: 2 additions & 2 deletions include/AbstractStringAppender.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class CUTELOGGERSHARED_EXPORT AbstractStringAppender : public AbstractAppender
private:
static QByteArray qCleanupFuncinfo(const char*);

QString m_format;
mutable QReadWriteLock m_formatLock;
QString m_format{};
mutable QReadWriteLock m_formatLock{};
};

#endif // ABSTRACTSTRINGAPPENDER_H
6 changes: 3 additions & 3 deletions include/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class CUTELOGGERSHARED_EXPORT CuteMessageLogger
int m_line;
const char* m_function;
const char* m_category;
QString m_message;
QString m_message{};
};


Expand Down Expand Up @@ -224,13 +224,13 @@ class CUTELOGGERSHARED_EXPORT LoggerTimingHelper

private:
Logger* m_logger;
QTime m_time;
QTime m_time{};
Logger::LogLevel m_logLevel;
Logger::TimingMode m_timingMode;
const char* m_file;
int m_line;
const char* m_function;
QString m_block;
QString m_block{};
};


Expand Down
8 changes: 4 additions & 4 deletions include/RollingFileAppender.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class CUTELOGGERSHARED_EXPORT RollingFileAppender : public FileAppender
void removeOldFiles();
void setDatePatternString(const QString& datePatternString);

QString m_datePatternString;
QString m_datePatternString{};
DatePattern m_frequency;

QDateTime m_rollOverTime;
QString m_rollOverSuffix;
QDateTime m_rollOverTime{};
QString m_rollOverSuffix{};
int m_logFilesLimit;
mutable QMutex m_rollingMutex;
mutable QMutex m_rollingMutex{};
};

#endif // ROLLINGFILEAPPENDER_H
10 changes: 5 additions & 5 deletions src/AbstractStringAppender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ QByteArray AbstractStringAppender::qCleanupFuncinfo(const char* name)
info.truncate(++pos);

if (info.at(pos - 1) == ')') {
if (info.indexOf(operator_call) == pos - (int)strlen(operator_call))
if (info.indexOf(operator_call) == pos - static_cast<int>(strlen(operator_call)))
break;

// this function returns a pointer to a function
Expand All @@ -224,19 +224,19 @@ QByteArray AbstractStringAppender::qCleanupFuncinfo(const char* name)
if (pos > -1) {
switch (info.at(pos)) {
case ')':
if (info.indexOf(operator_call) == pos - (int)strlen(operator_call) + 1)
if (info.indexOf(operator_call) == pos - static_cast<int>(strlen(operator_call)) + 1)
pos -= 2;
break;
case '<':
if (info.indexOf(operator_lessThan) == pos - (int)strlen(operator_lessThan) + 1)
if (info.indexOf(operator_lessThan) == pos - static_cast<int>(strlen(operator_lessThan)) + 1)
--pos;
break;
case '>':
if (info.indexOf(operator_greaterThan) == pos - (int)strlen(operator_greaterThan) + 1)
if (info.indexOf(operator_greaterThan) == pos - static_cast<int>(strlen(operator_greaterThan)) + 1)
--pos;
break;
case '=': {
int operatorLength = (int)strlen(operator_lessThanEqual);
int operatorLength = static_cast<int>(strlen(operator_lessThanEqual));
if (info.indexOf(operator_lessThanEqual) == pos - operatorLength + 1)
pos -= 2;
else if (info.indexOf(operator_greaterThanEqual) == pos - operatorLength + 1)
Expand Down
16 changes: 8 additions & 8 deletions src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,14 @@ class LoggerPrivate
static Logger* globalInstance;
static QReadWriteLock globalInstanceLock;

QList<AbstractAppender*> appenders;
QMutex loggerMutex;

QMap<QString, bool> categories;
QMultiMap<QString, AbstractAppender*> categoryAppenders;
QStringList noAppendersCategories; //<! Categories without appenders that was already warned about
QString defaultCategory;
bool writeDefaultCategoryToGlobalInstance;
QList<AbstractAppender*> appenders{};
QMutex loggerMutex{};

QMap<QString, bool> categories{};
QMultiMap<QString, AbstractAppender*> categoryAppenders{};
QStringList noAppendersCategories{}; //<! Categories without appenders that was already warned about
QString defaultCategory{};
bool writeDefaultCategoryToGlobalInstance = false;
};


Expand Down