Skip to content

Latest commit

 

History

History
115 lines (74 loc) · 5.35 KB

README.md

File metadata and controls

115 lines (74 loc) · 5.35 KB

DOI

Graylog logger

This is a simple logging library which can be used to send log messages to a Graylog server. This is done by creating messages in the GELF format and sending them to a Graylog server via TCP. For testing purposes a Vagrant machine running Graylog can be used. A simple Vagrantfile for creating this set-up can be found here. The argument for creating yet another logging library instead of writing a plugin/sink/handler for an already existing one is that a relatively light weight solution was desired. The library has functionality for writing log messages to console and file as well. By default the library will only write log messages to console.

The repository is split into four parts:

  • The logging library.
  • Unit tests of the logging library which are completely self contained (i.e. does not require a Graylog server).
  • A simple console application which uses the logging library.
  • Some benchmarking code which is used for profiling and optimising the code as well as test for performance regression.

A sister project to this library is the Python logging handler GraylogHandler.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

The logging library has the following (requried) external dependencies:

This library can also make use of the following (optional) dependencies:

You will also need CMake (version ≥ 3.9) to build the project. The project makes use of library and language features provided by C++14. It might be possible to link to the library using compilers that only supports C++11 though this has not been tested.

Due to the use of ASIO, the library should compile on most *nix systems and Windows 10 with no issues though only limited testing has been done.

Installing

There are two methods for building this library. They are described below.

Using conan

When using conan to provide the dependencies, all the optional and required dependencies are provided automatically. To checkout and build the library, run the following commands:

git clone https://github.com/ess-dmsc/graylog-logger.git
cd graylog-logger
mkdir build
cd build
conan install .. --build=outdated
cmake ..
make install

Making a conan package

If you are creating a conan package of this library you should disable CMake from running Conan by providing the following argument to CMake: -DCONAN=DISABLE. Furthermore, you must also use the cmake_find_package generator for CMake to be able to find the dependencies.

System installed dependencies

If using conan is not an option, it is possible to build the library using system installed dependencies. This requires a bit more work though and might not be as reliable.

Run the following commands:

git clone https://github.com/ess-dmsc/graylog-logger.git
cd graylog-logger
mkdir build
cd build
cmake .. -DCONAN=DISABLE -DCMAKE_PREFIX_PATH=/path/to/dir/containing/the/concurrentqueue/directory/
make install

Documentation

The code has some documentation. To generate it, run doxygen in the root of the repository i.e.:

cd graylog-logger
doxygen

Running the tests

If compiled, the unit tests are run by running the unit_tests application in the unit_tests directory of the builddirectory.

Deployment

Examples illustrating how the library can be used can be found in the examples.md file.

Built With

  • CMAKE - Cross platform makefile generation
  • Conan - Package manager for C++

Contributing

Get in contact by creating an issue. I will be happy to assist you making the changes that you want.

Versioning

We use SemVer for versioning. For the versions available, see the releases on github.

See description of changes

Authors

  • Jonas Nilsson - Initial work - SkyToGround
  • Afonso Mukai - Provided much assistance in setting up the continous integration system.
  • Matthew Jones - Improved the CMake code and suggested improvements to the interface.

See also the list of contributors to this project.

License

This project is licensed under the BSD-2 License - see the LICENSE.md file for details