Skip to content
/ Log Public

A global logger singleton without global initialization requirements

License

Notifications You must be signed in to change notification settings

njoy/Log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log

A global logger singleton for NJOY21 projects built upon the spdlog library.

Minimal Example

#include <sstream>
#include "Log.hpp"

using namespace njoy;

int main(){

  /* Logs use python-like format strings. See the fmt library for more information */
  Log::info( "I am {} years old", 23 );

  /* In addition, to the info level, warning, error, and debug levels are provided */
  Log::warning( "I am having {} for {}", "bean burrito", "lunch");
  Log::error( "The restaurant put {} on my {}", "pork", "bean burrito" );
  Log::debug( "This log will not be displayed when compiled with NDEBUG defined" );

  /* Additional sinks can be added to the logger */
  std::ostring_stream oss;
  Log::add_sink( oss );
  Log::add_sink( "path/to/my/log/file" );
}

About

A global logger singleton without global initialization requirements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published