Skip to content

Commit

Permalink
Merge pull request #434 from easylogging/develop
Browse files Browse the repository at this point in the history
v9.86 Release
  • Loading branch information
easylogging authored Dec 28, 2016
2 parents ba68ab7 + a1b2f7a commit e01f3fb
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 53 deletions.
102 changes: 61 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
‫بسم الله الرَّحْمَنِ الرَّحِيمِ


> **Manual For v9.85**
> **Manual For v9.86**
>
> [![Build Status](https://travis-ci.org/easylogging/easyloggingpp.png?branch=develop)](https://travis-ci.org/easylogging/easyloggingpp)
### Quick Links

[![download] Latest Release](https://github.com/easylogging/easyloggingpp/releases/latest)

[![notes] Release Notes](https://github.com/easylogging/easyloggingpp/tree/master/doc/RELEASE-NOTES-v9.85)
[![notes] Release Notes](https://github.com/easylogging/easyloggingpp/tree/master/doc/RELEASE-NOTES-v9.86)

[![samples] Samples](https://github.com/easylogging/easyloggingpp/tree/v9.85/samples)
[![samples] Samples](https://github.com/easylogging/easyloggingpp/tree/v9.86/samples)

[![paypal]](http://muflihun.com/support/)

Expand Down Expand Up @@ -53,8 +53,6 @@
<a href="#verbose-level">Verbose Level</a>
<a href="#check-if-verbose-logging-is-on">Check If Verbose Logging Is On</a>
<a href="#vmodule">VModule</a>
<a href="#stl-logging">STL Logging</a>
<a href="#supported-templates">Supported Templates</a>
<a href="#registering-new-loggers">Registering New Loggers</a>
<a href="#unregister-loggers">Unregister Loggers</a>
<a href="#populating-existing-logger-ids">Populating Existing Logger IDs</a>
Expand All @@ -71,6 +69,8 @@
<a href="#check-macros">CHECK Macros</a>
<a href="#logging-perror">Logging perror()</a>
<a href="#syslog">Using Syslog</a>
<a href="#stl-logging">STL Logging</a>
<a href="#supported-templates">Supported Templates</a>
<a href="#qt-logging">Qt Logging</a>
<a href="#boost-logging">Boost Logging</a>
<a href="#wxwidgets-logging">wxWidgets Logging</a>
Expand All @@ -93,7 +93,7 @@

# Introduction
Easylogging++ is single header only, feature-rich, efficient logging library for C++ applications. It has been written keeping three things in mind; performance, management (setup, configure, logging, simplicity) and portability. Its highly configurable and extremely useful for small to large sized projects.
This manual is for Easylogging++ v9.85. For other versions please refer to corresponding [release](https://github.com/easylogging/easyloggingpp/releases) on github.
This manual is for Easylogging++ v9.86. For other versions please refer to corresponding [release](https://github.com/easylogging/easyloggingpp/releases) on github.

[![top] Goto Top](#table-of-contents)

Expand Down Expand Up @@ -669,35 +669,6 @@ In order to change vmodules on the fly (instead of via command line args) - use

[![top] Goto Top](#table-of-contents)

### STL Logging
As mentioned earlier, with easylogging++, you can log your STL templates including most containers. In order to do so you will need to define `ELPP_STL_LOGGING` macro. This enables including all the necessary headers and defines all necessary functions.
For performance, containers are limited to log maximum of 100 entries. This behaviour can be changed by changed header file (base::consts::kMaxLogPerContainer) but not recommended as in order to log, writer has to go through each entry causing potential delays. But if you are not really concerned with performance, you may change this value.

[![top] Goto Top](#table-of-contents)

#### Supported Templates
Following templates are supported as part of STL Logging; note: basic and primitive types e.g, std::string or long are not listed as they is supported anyway, following list only contains non-basic types e.g, containers or bitset etc.

| * | * | * | * |
|-------------|-------------------------|------------------|------------------|
| std::vector | std::list | std::deque | std::queue |
| std::stack | std::priority_queue | std::set | std::multiset |
| std::pair | std::bitset | std::map | std::multimap |

Some C++11 specific templates are supported by further explicit macro definitions; note these also need `ELPP_STL_LOGGING`

| Template | Macro Needed |
|-------------------------|-----------------------------|
| std::array | `ELPP_LOG_STD_ARRAY` |
| std::unordered_map | `ELPP_LOG_UNORDERED_MAP` |
| std::unordered_multimap | `ELPP_LOG_UNORDERED_MAP` |
| std::unordered_set | `ELPP_LOG_UNORDERED_SET` |
| std::unordered_multiset | `ELPP_LOG_UNORDERED_SET` |

Standard manipulators are also supported, in addition std::stringstream is also supported.

[![top] Goto Top](#table-of-contents)

### Registering New Loggers
Loggers are unique in logger repository by ID. You can register new logger the same way as you would get logger. Using `getLogger(.., ..)` from `el::Loggers` helper class. This function takes two params, first being ID and second being boolean (optional) to whether or not to register new logger if does not already exist and returns pointer to existing (or newly created) el::Logger class. This second param is optional and defaults to true. If you set it to false and logger does not exist already, it will return nullptr.

Expand Down Expand Up @@ -746,7 +717,11 @@ After you share repository, you can reconfigure the only repository (i.e, the on
# Extra Features
Easylogging++ is feature-rich logging library. Apart from features already mentioned above, here are some extra features. If code snippets don't make sense and further sample is needed, there are many samples available at github repository (samples). Feel free to browse around.

Some features require you to define macros (marked as prerequisite in each section) to enable them. This is to reduce compile time. If you want to enable all features you can define `ELPP_FEATURE_ALL`.

### Performance Tracking
Prerequisite: Define macro `ELPP_FEATURE_PERFORMANCE_TRACKING`

One of the most notable features of Easylogging++ is its ability to track performance of your function or block of function.
Please note, this is not backward compatible as previously we had macros that user must had defined in order to track performance and I am sure many users had avoided in doing so. (Read v8.91 ReadMe for older way of doing it)
The new way of tracking performance is much easier and reliable. All you need to do is use one of two macros from where you want to start tracking.
Expand Down Expand Up @@ -901,6 +876,8 @@ There is a [sample](https://github.com/easylogging/easyloggingpp/tree/master/sam
[![top] Goto Top](#table-of-contents)
### Crash Handling
Prerequisite: Define macro `ELPP_FEATURE_CRASH_LOG`
Easylogging++ provides ability to handle unexpected crashes for GCC compilers. This is active by default and can be disabled by defining macro `ELPP_DISABLE_DEFAULT_CRASH_HANDLING`. By doing so you are telling library not to handle any crashes. Later on if you wish to handle crash yourself, you can assign crash handler of type void func(int) where int is signal caught.
Following signals are handled;
Expand Down Expand Up @@ -961,11 +938,15 @@ int main(void) {
[![top] Goto Top](#table-of-contents)

### Stacktrace
Prerequisite: Define macro `ELPP_FEATURE_CRASH_LOG`

Easylogging++ supports stack trace printing for GCC compilers. You can print stack trace at anytime by calling `el::base::debug::StackTrace()`, formatting will be done automatically. Note, if you are using non-GCC compiler, you will end-up getting empty output.

[![top] Goto Top](#table-of-contents)

### Multi-threading
Prerequisite: Define macro `ELPP_THREAD_SAFE`

Easylogging++ is thread-safe. By default thread-safety is disabled. You can enable it by defining `ELPP_THREAD_SAFE` otherwise you will see unexpected results. This is intentional to make library efficient for single threaded application.

[![top] Goto Top](#table-of-contents)
Expand Down Expand Up @@ -999,7 +980,9 @@ Easylogging++ supports `perror()` styled logging using `PLOG(LEVEL)`, `PLOG_IF(C
[![top] Goto Top](#table-of-contents)

### Syslog
Easylogging++ supports syslog for platforms that have `syslog.h` header. In order to enable it, you need to define `ELPP_SYSLOG`. If your platform does not have `syslog.h`, make sure you do not define this macro or you will end up in errors. Once you are ready to use syslog, you can do so by using one of `SYSLOG(LEVEL)`, `SYSLOG_IF(Condition, LEVEL)`, `SYSLOG_EVERY_N(n, LEVEL)` and uses logger ID: `syslog`. If you want to use custom logger you can do so by using `CSYSLOG(LEVEL, loggerId)` or `CSYSLOG_IF(Condition, LEVEL, loggerId)` or `CSYSLOG_EVERY_N(n, LEVEL, loggerId)`
Prerequisite: Define macro `ELPP_SYSLOG`

Easylogging++ supports syslog for platforms that have `syslog.h` header. If your platform does not have `syslog.h`, make sure you do not define this macro or you will end up in errors. Once you are ready to use syslog, you can do so by using one of `SYSLOG(LEVEL)`, `SYSLOG_IF(Condition, LEVEL)`, `SYSLOG_EVERY_N(n, LEVEL)` and uses logger ID: `syslog`. If you want to use custom logger you can do so by using `CSYSLOG(LEVEL, loggerId)` or `CSYSLOG_IF(Condition, LEVEL, loggerId)` or `CSYSLOG_EVERY_N(n, LEVEL, loggerId)`

Syslog in Easylogging++ supports C++ styled streams logging, following example;
```c++
Expand Down Expand Up @@ -1027,8 +1010,41 @@ Following levels are not supported and correspond to `LOG_NOTICE`: TRACE, wherea
[![top] Goto Top](#table-of-contents)
### STL Logging
Prerequisite: Define macro `ELPP_STL_LOGGING`
As mentioned earlier, with easylogging++, you can log your STL templates including most containers. In order to do so you will need to define `ELPP_STL_LOGGING` macro. This enables including all the necessary headers and defines all necessary functions.
For performance, containers are limited to log maximum of 100 entries. This behaviour can be changed by changed header file (base::consts::kMaxLogPerContainer) but not recommended as in order to log, writer has to go through each entry causing potential delays. But if you are not really concerned with performance, you may change this value.
[![top] Goto Top](#table-of-contents)
#### Supported Templates
Following templates are supported as part of STL Logging; note: basic and primitive types e.g, std::string or long are not listed as they is supported anyway, following list only contains non-basic types e.g, containers or bitset etc.
| * | * | * | * |
|-------------|-------------------------|------------------|------------------|
| std::vector | std::list | std::deque | std::queue |
| std::stack | std::priority_queue | std::set | std::multiset |
| std::pair | std::bitset | std::map | std::multimap |
Some C++11 specific templates are supported by further explicit macro definitions; note these also need `ELPP_STL_LOGGING`
| Template | Macro Needed |
|-------------------------|-----------------------------|
| std::array | `ELPP_LOG_STD_ARRAY` |
| std::unordered_map | `ELPP_LOG_UNORDERED_MAP` |
| std::unordered_multimap | `ELPP_LOG_UNORDERED_MAP` |
| std::unordered_set | `ELPP_LOG_UNORDERED_SET` |
| std::unordered_multiset | `ELPP_LOG_UNORDERED_SET` |
Standard manipulators are also supported, in addition std::stringstream is also supported.
[![top] Goto Top](#table-of-contents)
### Qt Logging
Easylogging++ has complete logging support for Qt core library. define `ELPP_QT_LOGGING` macro. This will include all the headers supported Qt logging. Once you did that, you should be good to go.
Prerequisite: Define macro `ELPP_QT_LOGGING`
Easylogging++ has complete logging support for Qt core library. When enabled, this will include all the headers supported Qt logging. Once you did that, you should be good to go.
Following Qt classes and containers are supported by Easylogging++ v9.0+
Expand All @@ -1045,9 +1061,9 @@ Also note, if you are logging a container that contains custom class, make sure
[![top] Goto Top](#table-of-contents)
### Boost Logging
Easylogging++ supports some of boost templates. In order to enable boost logging, define macro `ELPP_BOOST_LOGGING`
Prerequisite: Define macro `ELPP_BOOST_LOGGING`
Following table shows the templates supported.
Easylogging++ supports some of boost templates. Following table shows the templates supported.
| * | * |
|-------------------------------------|------------------------------------------|
Expand All @@ -1060,7 +1076,9 @@ Following table shows the templates supported.
[![top] Goto Top](#table-of-contents)
### wxWidgets Logging
Easylogging++ supports some of wxWidgets templates. In order to enable wxWidgets logging, define macro `ELPP_WXWIDGETS_LOGGING`
Prerequisite: Define macro `ELPP_WXWIDGETS_LOGGING`
Easylogging++ supports some of wxWidgets templates.
Following table shows the templates supported.
Expand Down Expand Up @@ -1195,6 +1213,8 @@ If you wish to capture log message right after it is dispatched, you can do so b
[![top] Goto Top](#table-of-contents)
### Asynchronous Logging
Prerequisite: Define macro `ELPP_EXPERIMENTAL_ASYNC`
Asynchronous logging is in experimental stages and they are not widely promoted. You may enable and test this feature by defining macro `ELPP_EXPERIMENTAL_ASYNC` and if you find some issue with the feature please report in [this issue](https://github.com/easylogging/easyloggingpp/issues/202). Reporting issues always help for constant improvements.
Please note:
Expand Down Expand Up @@ -1235,7 +1255,7 @@ Try to provide as much information as possible. Any bug with no clear informatio
Easylogging++ is free to use. You can check the details on where do donations go by clicking link below.
[![paypal]](http://muflihun.com/donation/)
[![paypal]](http://muflihun.com/support/)
[![top] Goto Top](#table-of-contents)
Expand Down
29 changes: 29 additions & 0 deletions doc/RELEASE-NOTES-v9.86
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Easylogging++ v9.86 RELEASE NOTES
---------------------------------

Release type: Major
API changes: No
Breaking Change: Yes

==========================
= NEW FEATURES =
==========================

- Stack trace and crash report now requires `ELPP_FEATURE_CRASH_LOG` macro (#409)
- Performance tracking now requires `ELPP_PERFORMANCE_TRACKING` macro defined (#409)
- do(something) || LOG(DEBUG) idiom (#426)

==========================
= FIXES =
==========================

- Do not create default file when using `ELPP_NO_LOG_TO_FILE` (completely fixed)

==========================
= NOTES =
==========================

- Licence now included in releases
- See https://github.com/easylogging/easyloggingpp/blob/v9.86/README.md for manual for this release
- See https://github.com/easylogging/easyloggingpp/tree/master/doc for other release notes
- Closed issues: https://github.com/easylogging/easyloggingpp/issues?page=1&state=closed
1 change: 1 addition & 0 deletions samples/API/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ macro="$macro -DELPP_STL_LOGGING"
macro="$macro -DELPP_LOG_UNORDERED_SET"
macro="$macro -DELPP_LOG_UNORDERED_MAP"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_FEATURE_ALL"

if [ "$2" = "" ];then
COMPILER=g++
Expand Down
2 changes: 1 addition & 1 deletion samples/MinGW/compile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ echo Assuming C:\MinGW for MinGW

set path=%path%;C:\MinGW\bin\

"C:\MinGW\bin\g++.exe" prog.cpp -std=c++11
"C:\MinGW\bin\g++.exe" prog.cpp -std=c++11 -DELPP_FEATURE_ALL
1 change: 1 addition & 0 deletions samples/OpenGL/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ macro="$macro -DELPP_LOG_STD_ARRAY"
macro="$macro -DELPP_LOG_UNORDERED_SET"
macro="$macro -DELPP_LOG_UNORDERED_MAP"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_FEATURE_ALL"

if [ "$2" = "" ];then
COMPILER=g++
Expand Down
1 change: 1 addition & 0 deletions samples/Qt/basic/qt-sample.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ greaterThan(QT_MAJOR_VERSION, 4)

CONFIG += static
DEFINES += ELPP_QT_LOGGING \
ELPP_FEATURE_ALL \
ELPP_STL_LOGGING \
ELPP_STRICT_SIZE_CHECK ELPP_UNICODE \
ELPP_MULTI_LOGGER_SUPPORT \
Expand Down
1 change: 1 addition & 0 deletions samples/Qt/fast-dictionary/fast-dictionary.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ QMAKE_LINK = $$COMPILER

QMAKE_CXXFLAGS += -std=c++0x
DEFINES += ELPP_STACKTRACE_ON_CRASH \
ELPP_FEATURE_ALL \
ELPP_MULTI_LOGGER_SUPPORT

SOURCES += main.cc\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TARGET = file-splitter-and-joiner
TEMPLATE = app

DEFINES += ELPP_QT_LOGGING \
ELPP_FEATURE_ALL \
ELPP_STL_LOGGING \
ELPP_STRICT_SIZE_CHECK \
ELPP_STACKTRACE_ON_CRASH \
Expand Down
1 change: 1 addition & 0 deletions samples/STL/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ macro="$macro -DELPP_LOG_UNORDERED_SET"
macro="$macro -DELPP_LOG_UNORDERED_MAP"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_LOGGING_FLAGS_FROM_ARG"
macro="$macro -DELPP_FEATURE_ALL"
# macro="$macro -DELPP_DEFAULT_LOG_FILE=\"/a/path/that/does/not/exist/f.log\""

if [ "$2" = "" ];then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#define ELPP_STL_LOGGING
#define ELPP_FEATURE_ALL

#define ELPP_THREAD_SAFE

Expand Down
1 change: 1 addition & 0 deletions samples/VC++/VCPP2013_PreviewUltimate/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define ELPP_FEATURE_ALL
#include "easylogging++.h"

INITIALIZE_EASYLOGGINGPP
Expand Down
1 change: 1 addition & 0 deletions samples/async/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
compiler=$1
macros=""
macro="$macro -DELPP_FEATURE_ALL"
if [ "$compiler" = "icpc" ];then
macros="$macros -DELPP_NO_SLEEP_FOR"
fi
Expand Down
1 change: 1 addition & 0 deletions samples/boost/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ macro="$macro -DELPP_THREAD_SAFE"
macro="$macro -DELPP_STL_LOGGING"
macro="$macro -DELPP_BOOST_LOGGING"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_FEATURE_ALL"

if [ "$2" = "" ];then
COMPILER=g++
Expand Down
1 change: 1 addition & 0 deletions samples/gtkmm/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FILE=$1
macro="$macro -DELPP_THREAD_SAFE"
macro="$macro -DELPP_STL_LOGGING"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_FEATURE_ALL"

if [ "$2" = "" ];then
COMPILER=g++
Expand Down
1 change: 1 addition & 0 deletions samples/wxWidgets/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ macro="$macro -DELPP_THREAD_SAFE"
macro="$macro -DELPP_STL_LOGGING"
macro="$macro -DELPP_WXWIDGETS_LOGGING"
macro="$macro -DELPP_STACKTRACE_ON_CRASH"
macro="$macro -DELPP_FEATURE_ALL"

if [ "$2" = "" ];then
COMPILER=g++
Expand Down
Loading

0 comments on commit e01f3fb

Please sign in to comment.