Skip to content

C++ library for sending Graylog Extended Log Format (GELF) messages using UDP protocol

License

Notifications You must be signed in to change notification settings

serge-14/gelflib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

gelflib

C++ library for sending Graylog Extended Log Format (GELF) messages using UDP protocol

Usage

Initialization

    // Initialize GELF library
    gelf::initialize();

    // Configure default host and port number
    gelf::configure( "127.0.0.1", 5000 );

    ...

    // Destroy gelf library
    gelf::destroy();

Simple Message

gelf::MessageBuilder message( gelf::Severity::Informational, "Hello world!" );

Complex Message

gelf::MessageBuilder message( gelf::Severity::Informational, "Hello world!" )
    .fullMessage( "Full message" )
    .fileName( "main.cpp", 25 )
    .lineNumber( 25 )
    .setHost( "localhost" );

With Additional Fields

gelf::MessageBuilder message( gelf::Severity::Informational, "Hello world!" )
    .additionalField( "additional_string", "value" )
    .additionalField( "additional_number", 25 );

Sending Message

// Creating message
gelf::MessageBuilder message( gelf::Severity::Informational, "Hello world!" );

// Sending message to configured host
gelf::post( message.build() );

About

C++ library for sending Graylog Extended Log Format (GELF) messages using UDP protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published