Skip to content

Commit

Permalink
Merge pull request #607 from muflihun/develop
Browse files Browse the repository at this point in the history
9.95.4
  • Loading branch information
abumq authored Feb 10, 2018
2 parents b7b4cbf + c06db0f commit 5fd54a0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ os: linux
dist: trusty
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y libgtest-dev valgrind
- sudo apt-get install -y libgtest-dev valgrind cmake
- sudo wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz
- sudo tar xf release-1.7.0.tar.gz
- cd googletest-release-1.7.0
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

## [9.95.4] - 10-02-2018
### Fixes
- Fix documentation (see PR#597)
- Fix buffer underflow in getBashOutput (see PR#596)

### Updates
- Added new function `Helpers::reserveCustomFormatSpecifier` (see #606)
- Made `DateTime::buildTimeInfo` public for use

## [9.95.3] - 13-10-2017
### Fixes
- Multithreading issue fixed raised from last release at log builder
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ option(lib_utc_datetime "Build library with UTC date/time logging" OFF)

set(ELPP_MAJOR_VERSION "9")
set(ELPP_MINOR_VERSION "95")
set(ELPP_PATCH_VERSION "3")
set(ELPP_PATCH_VERSION "4")
set(ELPP_VERSION_STRING "${ELPP_MAJOR_VERSION}.${ELPP_MINOR_VERSION}.${ELPP_PATCH_VERSION}")

set(ELPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Muflihun Labs
Copyright (c) 2012-2018 Muflihun Labs

https://github.com/muflihun/
https://muflihun.com
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![banner]

> **Manual For v9.95.3**
> **Manual For v9.95.4**
[![Build Status (Master)](https://img.shields.io/travis/muflihun/easyloggingpp/master.svg)](https://travis-ci.org/muflihun/easyloggingpp) [![Build Status (Develop)](https://img.shields.io/travis/muflihun/easyloggingpp/develop.svg)](https://travis-ci.org/muflihun/easyloggingpp) [![Version](https://img.shields.io/github/release/muflihun/easyloggingpp.svg)](https://github.com/muflihun/easyloggingpp/releases/latest)

Expand Down Expand Up @@ -100,7 +100,7 @@
# Overview
Easylogging++ is single header efficient logging library for C++ applications. It is extremely powerful, highly extendable and configurable to user's requirements. It provides ability to [write your own _sinks_](https://github.com/muflihun/easyloggingpp/tree/master/samples/send-to-network) (via featured referred as `LogDispatchCallback`). This library is currently used by [hundreds of open-source projects on github](https://github.com/search?q=%22easylogging%2B%2B.h%22&type=Code&utf8=%E2%9C%93) and other open-source source control management sites.

This manual is for Easylogging++ v9.95.3. For other versions please refer to corresponding [release](https://github.com/muflihun/easyloggingpp/releases) on github.
This manual is for Easylogging++ v9.95.4. For other versions please refer to corresponding [release](https://github.com/muflihun/easyloggingpp/releases) on github.

> You may also be interested in [Residue](https://github.com/muflihun/residue/) logging server.
Expand Down Expand Up @@ -476,7 +476,11 @@ Following table will explain all command line arguments that you may use to defi
### Configuration Macros
Some of logging options can be set by macros, this is a thoughtful decision, for example if we have `ELPP_THREAD_SAFE` defined, all the thread-safe functionalities are enabled otherwise disabled (making sure over-head of thread-safety goes with it). To make it easy to remember and prevent possible conflicts, all the macros start with `ELPP_`

NOTE: All the macros either need to be defined before `#include "easylogging++"` - but this gets hard and unreadable if project is getting bigger so we recommend you define all these macros using `-D` option of compiler, for example in case of `g++` you will do `g++ source.cpp ... -DELPP_SYSLOG -DELPP_THREAD_SAFE ...`
**NOTE:** All the macros can be defined in one of the following ways:

1. Define macros using `-D` option of compiler, for example in case of `g++` you will do `g++ source.cpp ... -DELPP_SYSLOG -DELPP_THREAD_SAFE ...` (**recommended way**)

2. Define macros inside `"easylogging++.h"` ([defining macros in other files won't work](https://github.com/muflihun/easyloggingpp/issues/590#issuecomment-346753951))

| Macro Name | Description |
|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -1015,7 +1019,7 @@ Easylogging++ supports CHECK macros, with these macros you can quickly check whe
| `CHECK_GT(a, b)` | Greater than e.g, `CHECK_GT(2, 1) << "How 2 is not greater than 1?";` |
| `CHECK_LE(a, b)` | Less than or equal e.g, `CHECK_LE(1, 1) << "1 is not equal or less than 1";` |
| `CHECK_GE(a, b)` | Greater than or equal e.g, `CHECK_GE(1, 1) << "1 is not equal or greater than 1";` |
| `CHECK_NOTNULL(pointer)` | Ensures pointer is not null - if OK returns pointer e.g, `explicit MyClass(Obj* obj) : m_obj(CHECK_NOT_NULL(obj)) {}` |
| `CHECK_NOTNULL(pointer)` | Ensures pointer is not null. This function does not return anything |
| `CHECK_STREQ(str1, str2)` | C-string equality (case-sensitive) e.g, `CHECK_STREQ(argv[1], "0") << "First arg cannot be 0";` |
| `CHECK_STRNE(str1, str2)` | C-string inequality (case-sensitive) e.g, `CHECK_STRNE(username1, username2) << "Usernames cannot be same";` |
| `CHECK_STRCASEEQ(str1, str2)` | C-string inequality (*case-insensitive*) e.g, `CHECK_CASESTREQ(argv[1], "Z") << "First arg cannot be 'z' or 'Z'";` |
Expand Down Expand Up @@ -1363,7 +1367,7 @@ Easylogging++ has also been tested with following C++ libraries;
```
The MIT License (MIT)

Copyright (c) 2017 Muflihun Labs
Copyright (c) 2012-2018 Muflihun Labs

https://github.com/muflihun/easyloggingpp
https://muflihun.com
Expand Down
14 changes: 8 additions & 6 deletions src/easylogging++.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//
// Bismillah ar-Rahmaan ar-Raheem
//
// Easylogging++ v9.95.3
// Easylogging++ v9.95.4
// Cross-platform logging library for C++ applications
//
// Copyright (c) 2017 muflihun.com
// Copyright (c) 2012-2018 Muflihun Labs
//
// This library is released under the MIT Licence.
// http://labs.muflihun.com/easyloggingpp/licence.php
Expand Down Expand Up @@ -997,8 +997,9 @@ const std::string OS::getBashOutput(const char* command) {
char hBuff[4096];
if (fgets(hBuff, sizeof(hBuff), proc) != nullptr) {
pclose(proc);
if (hBuff[strlen(hBuff) - 1] == '\n') {
hBuff[strlen(hBuff) - 1] = '\0';
const std::size_t buffLen = strlen(hBuff);
if (buffLen > 0 && hBuff[buffLen - 1] == '\n') {
hBuff[buffLen - 1] = '\0';
}
return std::string(hBuff);
} else {
Expand Down Expand Up @@ -2427,6 +2428,7 @@ Writer& Writer::construct(int count, const char* loggerIds, ...) {
va_list loggersList;
va_start(loggersList, loggerIds);
const char* id = loggerIds;
m_loggerIds.reserve(count);
for (int i = 0; i < count; ++i) {
m_loggerIds.push_back(std::string(id));
id = va_arg(loggersList, const char*);
Expand Down Expand Up @@ -2986,11 +2988,11 @@ void Loggers::clearVModules(void) {
// VersionInfo

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

} // namespace el
11 changes: 8 additions & 3 deletions src/easylogging++.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//
// Bismillah ar-Rahmaan ar-Raheem
//
// Easylogging++ v9.95.3
// Easylogging++ v9.95.4
// Single-header only, cross-platform logging library for C++ applications
//
// Copyright (c) 2017 muflihun.com
// Copyright (c) 2012-2018 Muflihun Labs
//
// This library is released under the MIT Licence.
// http://labs.muflihun.com/easyloggingpp/licence.php
Expand Down Expand Up @@ -1262,8 +1262,8 @@ class DateTime : base::StaticClass {
base::TimestampUnit timestampUnit);


private:
static struct ::tm* buildTimeInfo(struct timeval* currTime, struct ::tm* timeInfo);
private:
static char* parseFormat(char* buf, std::size_t bufSz, const char* format, const struct tm* tInfo,
std::size_t msec, const base::SubsecondPrecision* ssPrec);
};
Expand Down Expand Up @@ -3795,6 +3795,11 @@ class Helpers : base::StaticClass {
static inline const el::base::utils::CommandLineArgs* commandLineArgs(void) {
return ELPP->commandLineArgs();
}
/// @brief Reserve space for custom format specifiers for performance
/// @see std::vector::reserve
static inline void reserveCustomFormatSpecifiers(std::size_t size) {
ELPP->m_customFormatSpecifiers.reserve(size);
}
/// @brief Installs user defined format specifier and handler
static inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) {
ELPP->installCustomFormatSpecifier(customFormatSpecifier);
Expand Down

0 comments on commit 5fd54a0

Please sign in to comment.