Skip to content

Commit

Permalink
Update README and provide license information
Browse files Browse the repository at this point in the history
  • Loading branch information
2maz committed Sep 18, 2018
1 parent 860adb7 commit 56f0b4e
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 48 deletions.
12 changes: 12 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright 2016-2018 DFKI GmbH Robotics Innovation Center

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

119 changes: 84 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,79 @@
lib
=============
Rock base library containing common utilities
# base-logging

This is a header only library provides functionality to embed logging into your C++ project.
The logger allows you to log either in a printf-style or stream-style. For that purpose include it where needed and preferably in the .cpp files to avoid warnings about an undefined namespace for the logging.

```
#include<base-logging/Logging.hpp>
...
// printf-style logging
std::string information("test-logging happening here");
LOG_DEBUG("I provide you the following debug information: %s",
information.c_str());
LOG_INFO(...);
LOG_WARN(...);
LOG_ERROR(..);
LOG_FATAL(..);
// stream-style logging
LOG_DEBUG_S << information;
LOG_INFO_S << information;
...
LOG_FATAL << information;
```

The default output format of a log message looks like the following (without linebreak):
```
[20120120-11:58:00:577] [FATAL] - test_logger::A fatal error
occurred (/tmp/test_logger/src/Main.cpp:10 - int main(int, char**))
```

## Configuring the base logger

The logger can be configured at compile time to remove unwanted logging statement in a release version, and at runtime to control the verbosity level and logging format.

### Compile time

The following defines can be set to configure the logger at compile time:

**BASE_LOG_NAMESPACE** Setting the namespace to a unique string that allows you to filter the logging output, e.g. ROCK Macros automatically set it to the package name

**BASE_LOG_DISABLE** Deactivate all logging statements, e.g. for a realease binary.

**BASE_LOG_xxx** Compile only logs equal or higher than a certain level xxx into your binary, i.e. BASE_LOG_WARN disable all logs except for WARN, ERROR and FATAL Settings of log levels via environment variables with then only apply to the still activated levels.

**BASE_LONG_NAMES** Set this define in order to enforce a BASE_ prefix for the logging Macros, to avoid clashes with other libraries, i.e. BASE_LOG_DEBUG(…)

### At run-time

The following enviroment variables can be used to control the behaviour of the logger:
**BASE_LOG_LEVEL** Set to one of DEBUG, INFO, WARN, ERROR or FATAL to define the maximum logging level, e.g. export BASE_LOG_LEVEL=”DEBUG”

**BASE_LOG_COLOR** Activate colored logging (current configuration best for dark background coloured terminals), e.g. export BASE_LOG_COLOR

**BASE_LOG_FORMAT** Select from a set of predefined logging formats: DEFAULT, MULTILINE, SHORT, example outputs are given below:

The DEFAULT format contains no linebreaks (here only due to fit the narrow presentation):

```
[20120120-11:58:00:577] [FATAL] - test_logger::A fatal error
occurred (/tmp/test_logger/src/Main.cpp:10 - int main(int, char**))
```

The SHORT format reduces information to the log priority and the message:

```
[20120120-11:58:00:577] [FATAL] - test_logger::A fatal error
occurred (/tmp/test_logger/src/Main.cpp:10 - int main(int, char**))
```
The MULTILINE format split each individual log message across a minimum of three lines:
```
[20120120-11:58:59:976] in int main(int, char**)
/tmp/test_logger/src/Main.cpp:10
[FATAL] - test_logger::A fatal error occurred
```

License
-------
dummy-license

Installation
------------
Expand All @@ -19,37 +86,19 @@ most of its "library" packages (such as this one) to follow best practices. See
[this page](http://rock-robotics.org/stable/documentation/packages/outside_of_rock.html)
for installation instructions outside of Rock.

Rock CMake Macros
Dependencies
-----------------

This package uses a set of CMake helper shipped as the Rock CMake macros.
Documentations is available on [this page](http://rock-robotics.org/stable/documentation/packages/cmake_macros.html).

Rock Standard Layout
--------------------

This directory structure follows some simple rules, to allow for generic build
processes and simplify reuse of this project. Following these rules ensures that
the Rock CMake macros automatically handle the project's build process and
install setup properly.

STRUCTURE
-- src/
Contains all header (*.h/*.hpp) and source files
-- build/
The target directory for the build process, temporary content
-- bindings/
Language bindings for this package, e.g. put into subfolders such as
|-- ruby/
Ruby language bindings
-- viz/
Source files for a vizkit plugin / widget related to this library
-- resources/
General resources such as images that are needed by the program
-- configuration/
Configuration files for running the program
-- external/
When including software that needs a non standard installation process, or one that can be
easily embedded include the external software directly here
-- doc/
should contain the existing doxygen file: doxygen.conf

## Merge Requests and Issue Tracking

Github will be used for pull requests and issue tracking: https://github.com/rock-core/base-logging/

## License
This software source are licensed under the New/3-clause BSD license

## Copyright
(c) Copyright 2016-2018 DFKI GmbH Robotics Innovation Center
19 changes: 6 additions & 13 deletions manifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<package>
<description brief="Rock base library containing logging utilities">

Provision simple printf style and stream-based logging facilities
</description>
<author>Steffen Planthaber/[email protected]</author>
<license></license>
<url>http://</url>
<logo>http://</logo>
<author>Steffen Planthaber/[email protected]</author>
<author>Thomas Roehr/[email protected]</author>
<maintainer>Thomas Roehr/[email protected]</maintainer>
<license>New BSD License</license>
<url>https://github.com/rock-core/base-logging</url>
<depend package="base/cmake" />
<!--
To add any dependencies use the depend tag
<depend package="dummy-dependency-0" />
...
<depend package="dummy-dependency-n-1" />
<depend package="dummy-dependency-n" />
-->

</package>

0 comments on commit 56f0b4e

Please sign in to comment.