Skip to content

Commit 5fd54a0

Browse files
authored
Merge pull request #607 from muflihun/develop
9.95.4
2 parents b7b4cbf + c06db0f commit 5fd54a0

File tree

7 files changed

+37
-17
lines changed

7 files changed

+37
-17
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ os: linux
55
dist: trusty
66
before_install:
77
- sudo apt-get -qq update
8-
- sudo apt-get install -y libgtest-dev valgrind
8+
- sudo apt-get install -y libgtest-dev valgrind cmake
99
- sudo wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz
1010
- sudo tar xf release-1.7.0.tar.gz
1111
- cd googletest-release-1.7.0

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
## [9.95.4] - 10-02-2018
4+
### Fixes
5+
- Fix documentation (see PR#597)
6+
- Fix buffer underflow in getBashOutput (see PR#596)
7+
8+
### Updates
9+
- Added new function `Helpers::reserveCustomFormatSpecifier` (see #606)
10+
- Made `DateTime::buildTimeInfo` public for use
11+
312
## [9.95.3] - 13-10-2017
413
### Fixes
514
- Multithreading issue fixed raised from last release at log builder

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ option(lib_utc_datetime "Build library with UTC date/time logging" OFF)
2727

2828
set(ELPP_MAJOR_VERSION "9")
2929
set(ELPP_MINOR_VERSION "95")
30-
set(ELPP_PATCH_VERSION "3")
30+
set(ELPP_PATCH_VERSION "4")
3131
set(ELPP_VERSION_STRING "${ELPP_MAJOR_VERSION}.${ELPP_MINOR_VERSION}.${ELPP_PATCH_VERSION}")
3232

3333
set(ELPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 Muflihun Labs
3+
Copyright (c) 2012-2018 Muflihun Labs
44

55
https://github.com/muflihun/
66
https://muflihun.com

README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
![banner]
66

7-
> **Manual For v9.95.3**
7+
> **Manual For v9.95.4**
88
99
[![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)
1010

@@ -100,7 +100,7 @@
100100
# Overview
101101
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.
102102

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

105105
> You may also be interested in [Residue](https://github.com/muflihun/residue/) logging server.
106106
@@ -476,7 +476,11 @@ Following table will explain all command line arguments that you may use to defi
476476
### Configuration Macros
477477
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_`
478478

479-
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 ...`
479+
**NOTE:** All the macros can be defined in one of the following ways:
480+
481+
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**)
482+
483+
2. Define macros inside `"easylogging++.h"` ([defining macros in other files won't work](https://github.com/muflihun/easyloggingpp/issues/590#issuecomment-346753951))
480484

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

1366-
Copyright (c) 2017 Muflihun Labs
1370+
Copyright (c) 2012-2018 Muflihun Labs
13671371

13681372
https://github.com/muflihun/easyloggingpp
13691373
https://muflihun.com

src/easylogging++.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//
22
// Bismillah ar-Rahmaan ar-Raheem
33
//
4-
// Easylogging++ v9.95.3
4+
// Easylogging++ v9.95.4
55
// Cross-platform logging library for C++ applications
66
//
7-
// Copyright (c) 2017 muflihun.com
7+
// Copyright (c) 2012-2018 Muflihun Labs
88
//
99
// This library is released under the MIT Licence.
1010
// http://labs.muflihun.com/easyloggingpp/licence.php
@@ -997,8 +997,9 @@ const std::string OS::getBashOutput(const char* command) {
997997
char hBuff[4096];
998998
if (fgets(hBuff, sizeof(hBuff), proc) != nullptr) {
999999
pclose(proc);
1000-
if (hBuff[strlen(hBuff) - 1] == '\n') {
1001-
hBuff[strlen(hBuff) - 1] = '\0';
1000+
const std::size_t buffLen = strlen(hBuff);
1001+
if (buffLen > 0 && hBuff[buffLen - 1] == '\n') {
1002+
hBuff[buffLen - 1] = '\0';
10021003
}
10031004
return std::string(hBuff);
10041005
} else {
@@ -2427,6 +2428,7 @@ Writer& Writer::construct(int count, const char* loggerIds, ...) {
24272428
va_list loggersList;
24282429
va_start(loggersList, loggerIds);
24292430
const char* id = loggerIds;
2431+
m_loggerIds.reserve(count);
24302432
for (int i = 0; i < count; ++i) {
24312433
m_loggerIds.push_back(std::string(id));
24322434
id = va_arg(loggersList, const char*);
@@ -2986,11 +2988,11 @@ void Loggers::clearVModules(void) {
29862988
// VersionInfo
29872989

29882990
const std::string VersionInfo::version(void) {
2989-
return std::string("9.95.3");
2991+
return std::string("9.95.4");
29902992
}
29912993
/// @brief Release date of current version
29922994
const std::string VersionInfo::releaseDate(void) {
2993-
return std::string("13-10-2017 1134hrs");
2995+
return std::string("10-02-2018 1109hrs");
29942996
}
29952997

29962998
} // namespace el

src/easylogging++.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//
22
// Bismillah ar-Rahmaan ar-Raheem
33
//
4-
// Easylogging++ v9.95.3
4+
// Easylogging++ v9.95.4
55
// Single-header only, cross-platform logging library for C++ applications
66
//
7-
// Copyright (c) 2017 muflihun.com
7+
// Copyright (c) 2012-2018 Muflihun Labs
88
//
99
// This library is released under the MIT Licence.
1010
// http://labs.muflihun.com/easyloggingpp/licence.php
@@ -1262,8 +1262,8 @@ class DateTime : base::StaticClass {
12621262
base::TimestampUnit timestampUnit);
12631263

12641264

1265-
private:
12661265
static struct ::tm* buildTimeInfo(struct timeval* currTime, struct ::tm* timeInfo);
1266+
private:
12671267
static char* parseFormat(char* buf, std::size_t bufSz, const char* format, const struct tm* tInfo,
12681268
std::size_t msec, const base::SubsecondPrecision* ssPrec);
12691269
};
@@ -3795,6 +3795,11 @@ class Helpers : base::StaticClass {
37953795
static inline const el::base::utils::CommandLineArgs* commandLineArgs(void) {
37963796
return ELPP->commandLineArgs();
37973797
}
3798+
/// @brief Reserve space for custom format specifiers for performance
3799+
/// @see std::vector::reserve
3800+
static inline void reserveCustomFormatSpecifiers(std::size_t size) {
3801+
ELPP->m_customFormatSpecifiers.reserve(size);
3802+
}
37983803
/// @brief Installs user defined format specifier and handler
37993804
static inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) {
38003805
ELPP->installCustomFormatSpecifier(customFormatSpecifier);

0 commit comments

Comments
 (0)