Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 798 Bytes

README.md

File metadata and controls

29 lines (22 loc) · 798 Bytes

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" );
}