Giter Club home page Giter Club logo

gelfcpp's Introduction

Package Status

Build Status

gelfcpp

Library for sending Graylog Extended Log Format (GELF) messages from C++ applications.

Introduction

gelfcpp is a Graylog Extended Log Format (GELF) interface for C++. GELF is used by the open-source log management software Graylog. It is able to send structured message log message into the system without the need to do expensive parsing.

Requirements

  • CMake >= 3.1
  • C++14 compatible compiler
    • GCC >= 5.4.0
    • Clang >= 3.8.0
    • MSVC >= 14.2
  • Boost
    • system
    • iostreams (optional, for compression)
  • rapidjson v1.1.0 (included)
  • googetest v1.8.0 (included) (for tests only)
  • Doxygen (for documentation only)

Including gelfcpp in your projects

gelfcpp is header only and does not require building itself.

There are two methods for for including gelfcpp depending on your setup. The recommended approach is Variant 2: CMake subproject and directly checking out this reposity into your project. This way you can easily stay up to date with new releases!

Variant 1: simple

  1. Just copy everything in the include/ directory to your project and/or add gelfcpp to your include path.
  2. Verify that you provide rapidjson and Boost in your setup.
  3. Use it! See Examples.

Variant 2: CMake subproject

  1. Use the distribution as is (required CMakeLists.txt, dep/, include/)
  2. Add gelfcpp via CMake:
set(GELFCPP_AS_SUBPROJECT 1)
add_subdirectory(gelfcpp)
  1. This includes already both dependencies.
  2. Link your library/executable against the gelfcpp target in cmake:
add_executable(my_cool_project main.cpp)
target_link_libraries(my_cool_project PUBLIC gelfcpp)
  1. Use it! See Examples.

Examples

See Examples folder for further examples.

Sending messages to your Graylog instance.

#include <gelfcpp/GelfMessageStream.hpp>
#include <gelfcpp/output/GelfUDPOutput.hpp>
#include <gelfcpp/decorator/Timestamp.hpp>

int main()
{
    gelfcpp::output::GelfUDPOutput graylog("graylog.example.com", 12001);
    gelfcpp::decorator::CurrentTimestamp timestamp;

    GELF_MESSAGE(graylog)
                    ("host", "localhost")
                    (timestamp)
                    ("I'm sending a message from gelfcpp")
                    ("awesomeness", 1337);
}

gelfcpp's People

Contributors

daejiv avatar pss146 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.