Skip to content

Minimal TS streamlog

FU Chengdong requested to merge github/fork/rete/streamlog-mt-basic into master

Created by: rete

BEGINRELEASENOTES

  • Minimal adjustements for a thread safe implementation of streamlog
    • The global logstream instance streamlog::out becomes thread_local.
    • The global logger configuration is hold via an internal class logconfig
    • The user can initialize the global logger via, e.g:
logstream::global_init( &std::cout, "loggername" , MESSAGE::name() ) ;
  • Log levels registered automatically via the logstream::global_init() method
  • To cope with backward compatibility, users can use a pre-processor condition to initialize the logging:
#ifdef STREAMLOG_NEW_TS_IMPL
  // initialize the global logger config (new implementation)
  logstream::global_init( &std::cout, "loggername" , MESSAGE::name() ) ;
#else 
  // intiialize the global logger instance itself (old implementation)
  streamlog::out.init( std::cout, "loggername" ) ;
#endif
  • Added examples for standard streamlog and streamlog in multi-threading environment

ENDRELEASENOTES

The rest of the library has been updated internally, but the interface stays the same (except initialization as shown above). Note also that the multi-threaded example has been tested with helgrind and works fine.

Merge request reports

Loading