File indexing completed on 2026-04-09 07:49:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <cassert>
0021 #include "SArgs.hh"
0022
0023 #include "OPTICKS_LOG.hh"
0024
0025
0026 void check(const char* msg)
0027 {
0028 LOG(verbose) << msg ;
0029 LOG(verbose) << msg ;
0030 LOG(info) << msg ;
0031 LOG(debug) << msg ;
0032 LOG(warning) << msg ;
0033 LOG(error) << msg ;
0034 LOG(fatal) << msg ;
0035 }
0036
0037
0038 void test_standard_usage(int argc, char** argv)
0039 {
0040 OPTICKS_LOG(argc, argv);
0041
0042 assert(SLOG::instance);
0043
0044 check("local");
0045 SYSRAP_LOG::Check("calling SYSRAP lib from test main");
0046 }
0047
0048
0049 int main(int , char** argv_)
0050 {
0051 std::vector<std::string> tt ;
0052 tt.push_back( "--trace" );
0053 tt.push_back( "--verbose" );
0054 tt.push_back( "--debug" );
0055 tt.push_back( "--info" );
0056 tt.push_back( "--warning" );
0057 tt.push_back( "--error" );
0058 tt.push_back( "--fatal" );
0059
0060 tt.push_back( "--TRACE" );
0061 tt.push_back( "--VERBOSE" );
0062 tt.push_back( "--DEBUG" );
0063 tt.push_back( "--INFO" );
0064 tt.push_back( "--WARNING" );
0065 tt.push_back( "--ERROR" );
0066 tt.push_back( "--FATAL" );
0067
0068 tt.push_back( "--sysrap trace" );
0069 tt.push_back( "--sysrap verbose" );
0070 tt.push_back( "--sysrap debug" );
0071 tt.push_back( "--sysrap info" );
0072 tt.push_back( "--sysrap warning" );
0073 tt.push_back( "--sysrap error" );
0074 tt.push_back( "--sysrap fatal" );
0075
0076 tt.push_back( "--SYSRAP trace" );
0077 tt.push_back( "--SYSRAP verbose" );
0078 tt.push_back( "--SYSRAP debug" );
0079 tt.push_back( "--SYSRAP info" );
0080 tt.push_back( "--SYSRAP warning" );
0081 tt.push_back( "--SYSRAP error" );
0082 tt.push_back( "--SYSRAP fatal" );
0083
0084 tt.push_back( "--SYSRAP TRACE" );
0085 tt.push_back( "--SYSRAP VERBOSE" );
0086 tt.push_back( "--SYSRAP DEBUG" );
0087 tt.push_back( "--SYSRAP INFO" );
0088 tt.push_back( "--SYSRAP WARNING" );
0089 tt.push_back( "--SYSRAP ERROR" );
0090 tt.push_back( "--SYSRAP FATAL" );
0091
0092
0093 const char* fallback = "info" ;
0094 const char* prefix = "SYSRAP" ;
0095
0096 for(unsigned j=0 ; j < 2 ; j++)
0097 {
0098
0099 for(unsigned i=0 ; i < tt.size() ; i++)
0100 {
0101 std::string t = tt[i];
0102
0103 SArgs* a = new SArgs(argv_[0], t.c_str()) ;
0104
0105 const char* uprefix = j == 0 ? NULL : prefix ;
0106
0107 if(SLOG::instance != NULL) SLOG::instance = NULL ;
0108
0109 SLOG* pl = new SLOG(a->argc, a->argv, fallback, uprefix );
0110
0111 std::stringstream ss ;
0112 ss << "SLOG(..," << fallback ;
0113 if(j==1) ss << "," << uprefix ;
0114 ss << ")" ;
0115
0116 std::string label = ss.str();
0117
0118 std::cout << std::setw(50) << t
0119 << std::setw(30) << label
0120 << std::setw(5) << pl->level
0121 << std::setw(10) << pl->name()
0122 << std::endl
0123 ;
0124 }
0125 }
0126
0127 return 0 ;
0128 }