Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
simple_cpp_logger
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ingo Meyer
simple_cpp_logger
Commits
93763588
Commit
93763588
authored
Feb 24, 2017
by
Ingo Meyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a readme file
parent
d487480d
Pipeline
#1031
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
README.rst
README.rst
+61
-0
No files found.
README.rst
0 → 100644
View file @
93763588
Simple C++ Logger
#################
Overview
========
This project provides a simple C++ logger class and API. It supports different logging levels and colorized logging
output. Logging messages that do not conform to the desired display logging level are filtered in the preprocessor
stage and do not affect the program runtime. Therefore, you can add as many logging messages as you want without
affecting cpu or memory usage of the production version of your software.
Currently, Linux and macOS are supported. It is not tested on Windows yet.
Usage
=====
Just add ``logger.cpp`` and ``logger.hpp`` to your project files; they have no dependencies to other libraries. Then
you can use the global default logger by calling:
.. code-block:: cpp
logger(DEBUG, << "my logging output of variable x" << x << std::endl);
You can output every variable that can be shifted ``<<`` into a ``std::ostream`` object like ``std::cout`` or
``std::cerr``.
Currently, 5 levels of logging output are supported. The levels can be enabled or disabled step-by-step to increase or
decrease the verbosity of the program:
- ``DEBUG``
- ``INFO``
- ``WARNING``
- ``ERROR``
- ``CRITICAL``
Each logging level is displayed in a different color.
The displayed logging levels can be controlled by a ``DEFAULT_LOG_LEVEL`` macro. If it is not set it defaults to
``DEBUG`` in a debug environment (``NDEBUG`` macro not set). If ``NDEBUG`` is set, the default logging level is
``WARNING``. The logger can be disabled completely by setting an ``NLOG`` macro. The chosen log level automatically
includes log levels that are less verbose. For example, if ``WARNING`` is set, ``ERROR`` and ``CRITICAL`` logging
messages are also printed to screen.
Example
=======
For a small demonstration, you can compile and execute the test program included in the ``src/`` directory by
entering:
.. code-block:: bash
make
./test
You should get the following output:
.. image:: http://iffwww/pub/media/simple_cpp_logger.gif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment