Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:18

0001 /**
0002 SLOGTest.cc
0003 =============
0004 
0005 
0006 * I recall finding that the main level must larger than the libs
0007   for all the expected libs output to appear 
0008   ie that both level criteria gets applied 
0009 
0010   * TODO: confirm this, and see if some other organization might avoid that
0011 
0012 * https://github.com/SergiusTheBest/plog/issues/72
0013 
0014 ::
0015 
0016     Also you can rewrite your previous sample:
0017 
0018     plog::init<1000>(plog::verbose, "/var/log/my.log");
0019     plog::init<0>(plog::info, plog::get<1000>());
0020     plog::init<1>(plog::debug, plog::get<1000>());
0021     plog::init<2>(plog::warning, plog::get<1000>());
0022 
0023     so the default log stays 0 and the sink becomes 1000.
0024 
0025 
0026 
0027 **/
0028 
0029 
0030 #include "OPTICKS_LOG.hh"
0031 
0032 int main(int argc, char** argv)
0033 {
0034     OPTICKS_LOG(argc, argv); 
0035 
0036     std::cout << "SLOG::Flags() " << SLOG::Flags() << std::endl ; 
0037 
0038 
0039     plog::Logger<0>* main_logger = plog::get<0>() ; 
0040 
0041     plog::Severity main_level = main_logger->getMaxSeverity(); 
0042     std::cout 
0043         << " main_logger  " << main_logger 
0044         << " plog::severityToString(main_level) " << plog::severityToString(main_level) 
0045         << std::endl  
0046         ; 
0047 
0048     std::cout 
0049         << " SLOG::Desc<0>(main_logger) " << SLOG::Desc<0>(main_logger) 
0050         << std::endl  
0051         << " SLOG::Desc<0>() lib_logger " << SLOG::Desc<0>() 
0052         << std::endl  
0053         ; 
0054 
0055 
0056     bool change_main_level = false ; 
0057     if( change_main_level  )
0058     {
0059         main_logger->setMaxSeverity(info) ; 
0060         std::cout 
0061             << " SLOG::Desc<0>(main_logger) " << SLOG::Desc<0>(main_logger) 
0062             << " : after main_logger->setMaxSeverity(info) "
0063             << std::endl  
0064             ; 
0065     }
0066 
0067 
0068     std::cout << " [ logging from main " << std::endl ; 
0069     LOG(none)    << " LOG(none) " ; 
0070     LOG(fatal)   << " LOG(fatal) " ; 
0071     LOG(error)   << " LOG(error) " ; 
0072     LOG(warning) << " LOG(warning) " ; 
0073     LOG(info)    << " LOG(info) " ; 
0074     LOG(debug)   << " LOG(debug) " ; 
0075     LOG(verbose) << " LOG(verbose) " ; 
0076     std::cout << " ] logging from main " << std::endl ; 
0077 
0078 
0079     std::cout << " [ logging from lib " << std::endl ; 
0080     SLOG::Dump(); 
0081     std::cout << " ] logging from lib " << std::endl ; 
0082 
0083     return 0 ; 
0084 }