Skip to content

philipp-zimmermann/Bragi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bragi

Version 1.0.0

Bragi is a minimal C++ logging framework.

framework features

  • ideal release performance: when Logging is turned off completely, or a message is below the cutoff level, zero computational overhead is generated, when compiling in release mode.
  • thread safety: different threads can log to the system, without intermingling the messages provided with the stream operator.
  • minimal: this is meant to provide a minimal but complete logging framework, with next to no code bloating.
  • log to file or console: the system can either print to a specified file or to the console (via std::cerr).
  • logging levels: the framework provides different logging levels for each message.
  • global cutoff level: this enables the user to decide to what level of detail the system should print.
  • local cutoff level: this overrides the global cutoff level, and provides more flexibility.
  • stream operator: the system is set up to log any message-type for which an overload for std::ostream::operator<< is defined.
  • scope specific configuration: logging for individual scopes can easily be switched on or off, or otherwise configured.
  • log level prefix: The log level of each message is printed always before each message.
  • source class prefix: the logging system is able to provide the class name, from where the logging is called, in squared brackets as a prefix to each message.

system specifics

  • C++14 is the minimum required standard.
  • compiles with clang 9.0, gcc 7.4, gcc 9.0 with warning flags: -Wall, -Wextra, & -Wpedantic
  • compiles with MSVC with warning flags: -W4, /wd4127

appearance

The default (= colored console) output looks like this:
colored console output
[TRACE], [DEBUG], [INFO], [WARN], [ERROR], [DEV], [CUSTOM:X] are the log level prefixes, these are printed always. [SomeClass] is the source class prefix, it is only printed if provided. The rest is the logging message body.

usage of the framework

First step: include the header bragi.

minimal

If you want to use only the barebone features of this library the only thing to do is call the macro BRAGI_INIT() within the scope you intend to use the logging functions.

After that you can use the other provided macros:

  • LOG_TRACE
  • LOG_DEBUG
  • LOG_EVAL
  • LOG_INFO
  • LOG_WARN
  • LOG_ERROR
  • LOG_DEV

in the same way you would use std::cout, for example:

#include "bragi"

BRAGI_INIT()

int main()
{
  LOG_INFO << "Hello World!\n";
}

Refer to exampleProject/hello_world.cpp.

extended features

For now: refer to exampleProject/example.cpp.


future features

  • A more detailled usage description of the extended features.
  • Messages without printed Log Level prefix.
  • parallel logging with console and file.
  • automatic testing.

About

C++ Logging Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors