Skip to content

Commit

Permalink
Merge pull request #34 from muflihun/develop
Browse files Browse the repository at this point in the history
1.2.2
  • Loading branch information
abumq authored Feb 14, 2018
2 parents b6c8725 + 8b917d9 commit 604e630
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 82 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [1.2.2]
### Updates
- Upgraded Easylogging++ from 9.95.4 to 9.96.0

## [1.2.1]
### Updates
- Separated translation units for development
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ option (special_edition "Special edition build" OFF)

set (RESIDUE_MAJOR "1")
set (RESIDUE_MINOR "2")
set (RESIDUE_PATCH "1")
set (RESIDUE_PATCH "2")

set (RESIDUE_SOVERSION "${RESIDUE_MAJOR}.${RESIDUE_MINOR}.${RESIDUE_PATCH}")
set (RESIDUE_NAME "Residue-C++")
Expand Down
4 changes: 2 additions & 2 deletions FindResidue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ set (RESIDUE_EXTRA_INCLUDE_DIRS "")
if (Residue_USE_STATIC_LIBS)
message ("-- Residue: Static linking")
find_library(RESIDUE_LIBRARY_LOCAL
NAMES libresidue-static-full.a libresidue-static.a libresidue.a
NAMES libresidue-static-full.a libresidue-static.a libresidue.a libresidue.lib residue.lib
HINTS "${RESIDUE_PATHS}/lib"
)
else()
message ("-- Residue: Dynamic linking")
find_library(RESIDUE_LIBRARY_LOCAL
NAMES libresidue.dylib libresidue.so libresidue residue
NAMES libresidue.dylib libresidue.so libresidue residue libresidue.dll residue.dll
HINTS "${RESIDUE_PATHS}/lib"
)
endif()
Expand Down
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Copyright 2017-present Muflihun Labs
Copyright 2017-present @abumusamq

https://github.com/muflihun/
https://muflihun.com
https://muflihun.github.io
https://muflihun.com/
https://muflihun.github.io/

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
21 changes: 15 additions & 6 deletions include/easylogging++.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
//
// Bismillah ar-Rahmaan ar-Raheem
//
// Easylogging++ v9.95.4
// Easylogging++ v9.96.0
// Single-header only, cross-platform logging library for C++ applications
//
// Copyright (c) 2012-2018 Muflihun Labs
// Copyright (c) 2012-2018 @abumusamq
//
// This library is released under the MIT Licence.
// http://labs.muflihun.com/easyloggingpp/licence.php
// https://github.com/muflihun/easyloggingpp/blob/master/LICENSE
//
// https://github.com/muflihun/easyloggingpp
// https://muflihun.github.io/easyloggingpp
// http://muflihun.com
//

#ifndef EASYLOGGINGPP_H
#define EASYLOGGINGPP_H
// Compilers and C++0x/C++11 Evaluation
Expand Down Expand Up @@ -2601,7 +2603,7 @@ class IWorker {
};
#endif // ELPP_ASYNC_LOGGING
/// @brief Easylogging++ management storage
class Storage : base::NoCopy, public base::threading::ThreadSafe {
class Storage : base::NoCopy {
public:
#if ELPP_ASYNC_LOGGING
Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker);
Expand Down Expand Up @@ -2685,6 +2687,10 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe {
return &m_customFormatSpecifiers;
}

base::threading::Mutex& customFormatSpecifiersLock() {
return m_customFormatSpecifiersLock;
}

inline void setLoggingLevel(Level level) {
m_loggingLevel = level;
}
Expand Down Expand Up @@ -2725,11 +2731,12 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe {
/// @brief Sets thread name for current thread. Requires std::thread
inline void setThreadName(const std::string& name) {
if (name.empty()) return;
base::threading::ScopedLock scopedLock(lock());
base::threading::ScopedLock scopedLock(m_threadNamesLock);
m_threadNames[base::threading::getCurrentThreadId()] = name;
}

inline std::string getThreadName(const std::string& threadId) {
base::threading::ScopedLock scopedLock(m_threadNamesLock);
std::map<std::string, std::string>::const_iterator it = m_threadNames.find(threadId);
if (it == m_threadNames.end()) {
return threadId;
Expand All @@ -2751,6 +2758,8 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe {
std::map<std::string, base::type::PerformanceTrackingCallbackPtr> m_performanceTrackingCallbacks;
std::map<std::string, std::string> m_threadNames;
std::vector<CustomFormatSpecifier> m_customFormatSpecifiers;
base::threading::Mutex m_customFormatSpecifiersLock;
base::threading::Mutex m_threadNamesLock;
Level m_loggingLevel;

friend class el::Helpers;
Expand Down Expand Up @@ -2793,7 +2802,7 @@ class AsyncDispatchWorker : public base::IWorker, public base::threading::Thread
void run(void);

void setContinueRunning(bool value) {
base::threading::ScopedLock scopedLock(m_continueRunningMutex);
base::threading::ScopedLock scopedLock(m_continueRunningLock);
m_continueRunning = value;
}

Expand All @@ -2803,7 +2812,7 @@ class AsyncDispatchWorker : public base::IWorker, public base::threading::Thread
private:
std::condition_variable cv;
bool m_continueRunning;
base::threading::Mutex m_continueRunningMutex;
base::threading::Mutex m_continueRunningLock;
};
#endif // ELPP_ASYNC_LOGGING
} // namespace base
Expand Down
11 changes: 6 additions & 5 deletions include/residue.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//
// Residue.h
// residue.h
//
// Official C++ client library for Residue logging server
//
// Copyright (C) 2017 Muflihun Labs
// Copyright (C) 2017-present Muflihun Labs
// Copyright (C) 2017-present @abumusamq
//
// https://muflihun.com
// https://muflihun.github.io/residue
// https://github.com/muflihun/residue-cpp
// https://muflihun.com/
// https://muflihun.github.io/residue/
// https://github.com/muflihun/residue-cpp/
//
// See https://github.com/muflihun/residue-cpp/blob/master/LICENSE
// for licensing information
Expand Down
6 changes: 3 additions & 3 deletions samples/detailed-cmake/src/app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) {

std::cout << Residue::info() << std::endl;

#if 1 // minimal sample with unknown logger
#if 0 // minimal sample with unknown logger
try {
Residue::connect("residue-server", Residue::DEFAULT_PORT);
} catch (const ResidueException& e) {
Expand Down Expand Up @@ -145,7 +145,7 @@ int main(int argc, char* argv[]) {
// in (you just need to make sure that accessCodes in still in scope when you
// call Residue::connect()

#if 0
#if 1
//
// Optional: Providing "--bulk" option enables bulk dispatch for residue which means each log request
// will be sent to the server in batch of bulk size. See following links for details
Expand Down Expand Up @@ -231,7 +231,7 @@ int main(int argc, char* argv[]) {
#endif

// Below code is only for benchmark test
#if 0
#if 1
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
for (unsigned long i = 1; i <= 1000000; ++i) {
LOG(INFO) << "Test";
Expand Down
9 changes: 4 additions & 5 deletions src/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// Official C++ client library for Residue logging server
//
// Copyright (C) 2017-present Muflihun Labs
// Copyright (C) 2017-present @abumusamq
//
// Author: @abumusamq
//
// https://muflihun.com
// https://muflihun.github.io/residue
// https://github.com/muflihun/residue-cpp
// https://muflihun.com/
// https://muflihun.github.io/residue/
// https://github.com/muflihun/residue-cpp/
//
// See https://github.com/muflihun/residue-cpp/blob/master/LICENSE
// for licensing information
Expand Down
9 changes: 4 additions & 5 deletions src/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// Official C++ client library for Residue logging server
//
// Copyright (C) 2017-present Muflihun Labs
// Copyright (C) 2017-present @abumusamq
//
// Author: @abumusamq
//
// https://muflihun.com
// https://muflihun.github.io/residue
// https://github.com/muflihun/residue-cpp
// https://muflihun.com/
// https://muflihun.github.io/residue/
// https://github.com/muflihun/residue-cpp/
//
// See https://github.com/muflihun/residue-cpp/blob/master/LICENSE
// for licensing information
Expand Down
40 changes: 17 additions & 23 deletions src/easylogging++.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
//
// Bismillah ar-Rahmaan ar-Raheem
//
// Easylogging++ v9.95.4
// Easylogging++ v9.96.0
// Cross-platform logging library for C++ applications
//
// Copyright (c) 2012-2018 Muflihun Labs
// Copyright (c) 2012-2018 @abumusamq
//
// This library is released under the MIT Licence.
// http://labs.muflihun.com/easyloggingpp/licence.php
// https://github.com/muflihun/easyloggingpp/blob/master/LICENSE
//
// https://github.com/muflihun/easyloggingpp
// https://muflihun.github.io/easyloggingpp
// http://muflihun.com
//

#include "easylogging++.h"
#include "../include/easylogging++.h"

#if defined(AUTO_INITIALIZE_EASYLOGGINGPP)
INITIALIZE_EASYLOGGINGPP
Expand Down Expand Up @@ -1622,10 +1623,11 @@ void TypedConfigurations::build(Configurations* configurations) {
} else if (conf->configurationType() == ConfigurationType::PerformanceTracking) {
setValue(Level::Global, getBool(conf->value()), &m_performanceTrackingMap);
} else if (conf->configurationType() == ConfigurationType::MaxLogFileSize) {
setValue(conf->level(), static_cast<std::size_t>(getULong(conf->value())), &m_maxLogFileSizeMap);
#if !defined(ELPP_NO_DEFAULT_LOG_FILE)
withFileSizeLimit.push_back(conf);
#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE)
auto v = getULong(conf->value());
setValue(conf->level(), static_cast<std::size_t>(v), &m_maxLogFileSizeMap);
if (v != 0) {
withFileSizeLimit.push_back(conf);
}
} else if (conf->configurationType() == ConfigurationType::LogFlushThreshold) {
setValue(conf->level(), static_cast<std::size_t>(getULong(conf->value())), &m_logFlushThresholdMap);
}
Expand Down Expand Up @@ -1699,12 +1701,6 @@ std::string TypedConfigurations::resolveFilename(const std::string& filename) {
}

void TypedConfigurations::insertFile(Level level, const std::string& fullFilename) {
#if defined(ELPP_NO_LOG_TO_FILE)
setValue(level, false, &m_toFileMap);
ELPP_UNUSED(fullFilename);
m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(nullptr)));
return;
#endif
std::string resolvedFilename = resolveFilename(fullFilename);
if (resolvedFilename.empty()) {
std::cerr << "Could not load empty file for logging, please re-check your configurations for level ["
Expand Down Expand Up @@ -1840,8 +1836,10 @@ bool RegisteredLoggers::remove(const std::string& id) {
if (id == base::consts::kDefaultLoggerId) {
return false;
}
// get has internal lock
Logger* logger = base::utils::Registry<Logger, std::string>::get(id);
if (logger != nullptr) {
// unregister has internal lock
unregister(logger);
}
return true;
Expand Down Expand Up @@ -2046,7 +2044,7 @@ Storage::~Storage(void) {
}

bool Storage::hasCustomFormatSpecifier(const char* formatSpecifier) {
base::threading::ScopedLock scopedLock(lock());
base::threading::ScopedLock scopedLock(customFormatSpecifiersLock());
return std::find(m_customFormatSpecifiers.begin(), m_customFormatSpecifiers.end(),
formatSpecifier) != m_customFormatSpecifiers.end();
}
Expand All @@ -2055,12 +2053,12 @@ void Storage::installCustomFormatSpecifier(const CustomFormatSpecifier& customFo
if (hasCustomFormatSpecifier(customFormatSpecifier.formatSpecifier())) {
return;
}
base::threading::ScopedLock scopedLock(lock());
base::threading::ScopedLock scopedLock(customFormatSpecifiersLock());
m_customFormatSpecifiers.push_back(customFormatSpecifier);
}

bool Storage::uninstallCustomFormatSpecifier(const char* formatSpecifier) {
base::threading::ScopedLock scopedLock(lock());
base::threading::ScopedLock scopedLock(customFormatSpecifiersLock());
std::vector<CustomFormatSpecifier>::iterator it = std::find(m_customFormatSpecifiers.begin(),
m_customFormatSpecifiers.end(), formatSpecifier);
if (it != m_customFormatSpecifiers.end() && strcmp(formatSpecifier, it->formatSpecifier()) == 0) {
Expand Down Expand Up @@ -2349,7 +2347,7 @@ base::type::string_t DefaultLogBuilder::build(const LogMessage* logMessage, bool
base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kMessageFormatSpecifier, logMessage->message());
}
#if !defined(ELPP_DISABLE_CUSTOM_FORMAT_SPECIFIERS)
el::base::threading::ScopedLock lock_(ELPP->lock());
el::base::threading::ScopedLock lock_(ELPP->customFormatSpecifiersLock());
ELPP_UNUSED(lock_);
for (std::vector<CustomFormatSpecifier>::const_iterator it = ELPP->customFormatSpecifiers()->begin();
it != ELPP->customFormatSpecifiers()->end(); ++it) {
Expand Down Expand Up @@ -2448,7 +2446,6 @@ void Writer::initializeLogger(const std::string& loggerId, bool lookup, bool nee
}
if (m_logger == nullptr) {
{
base::threading::ScopedLock scopedLock(ELPP->lock());
if (!ELPP->registeredLoggers()->has(std::string(base::consts::kDefaultLoggerId))) {
// Somehow default logger has been unregistered. Not good! Register again
ELPP->registeredLoggers()->get(std::string(base::consts::kDefaultLoggerId));
Expand Down Expand Up @@ -2824,7 +2821,6 @@ void Helpers::logCrashReason(int sig, bool stackTraceIfAvailable, Level level, c
// Loggers

Logger* Loggers::getLogger(const std::string& identity, bool registerIfNotAvailable) {
base::threading::ScopedLock scopedLock(ELPP->lock());
return ELPP->registeredLoggers()->get(identity, registerIfNotAvailable);
}

Expand All @@ -2833,12 +2829,10 @@ void Loggers::setDefaultLogBuilder(el::LogBuilderPtr& logBuilderPtr) {
}

bool Loggers::unregisterLogger(const std::string& identity) {
base::threading::ScopedLock scopedLock(ELPP->lock());
return ELPP->registeredLoggers()->remove(identity);
}

bool Loggers::hasLogger(const std::string& identity) {
base::threading::ScopedLock scopedLock(ELPP->lock());
return ELPP->registeredLoggers()->has(identity);
}

Expand Down Expand Up @@ -2988,11 +2982,11 @@ void Loggers::clearVModules(void) {
// VersionInfo

const std::string VersionInfo::version(void) {
return std::string("9.95.4");
return std::string("9.96.0");
}
/// @brief Release date of current version
const std::string VersionInfo::releaseDate(void) {
return std::string("10-02-2018 1109hrs");
return std::string("14-02-2018 1629hrs");
}

} // namespace el
9 changes: 4 additions & 5 deletions src/internal-logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// Official C++ client library for Residue logging server
//
// Copyright (C) 2017-present Muflihun Labs
// Copyright (C) 2017-present @abumusamq
//
// Author: @abumusamq
//
// https://muflihun.com
// https://muflihun.github.io/residue
// https://github.com/muflihun/residue-cpp
// https://muflihun.com/
// https://muflihun.github.io/residue/
// https://github.com/muflihun/residue-cpp/
//
// See https://github.com/muflihun/residue-cpp/blob/master/LICENSE
// for licensing information
Expand Down
9 changes: 4 additions & 5 deletions src/internal-logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// Official C++ client library for Residue logging server
//
// Copyright (C) 2017-present Muflihun Labs
// Copyright (C) 2017-present @abumusamq
//
// Author: @abumusamq
//
// https://muflihun.com
// https://muflihun.github.io/residue
// https://github.com/muflihun/residue-cpp
// https://muflihun.com/
// https://muflihun.github.io/residue/
// https://github.com/muflihun/residue-cpp/
//
// See https://github.com/muflihun/residue-cpp/blob/master/LICENSE
// for licensing information
Expand Down
Loading

0 comments on commit 604e630

Please sign in to comment.