Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Copyright (c) 2019 Opticks Team. All Rights Reserved.
0003  *
0004  * This file is part of Opticks
0005  * (see https://bitbucket.org/simoncblyth/opticks).
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License"); 
0008  * you may not use this file except in compliance with the License.  
0009  * You may obtain a copy of the License at
0010  *
0011  *   http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software 
0014  * distributed under the License is distributed on an "AS IS" BASIS, 
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0016  * See the License for the specific language governing permissions and 
0017  * limitations under the License.
0018  */
0019 
0020 #include "SLOG.hh"
0021 #include "SArgs.hh"
0022 
0023 
0024 void test_arguments(const char* exe)
0025 {
0026     std::vector<std::string> tt  ; 
0027     tt.push_back( "--trace" );
0028     tt.push_back( "--verbose" );
0029     tt.push_back( "--debug" );
0030     tt.push_back( "--info" );
0031     tt.push_back( "--warning" );
0032     tt.push_back( "--error" );
0033     tt.push_back( "--fatal" );
0034 
0035     tt.push_back( "--TRACE" );
0036     tt.push_back( "--VERBOSE" );
0037     tt.push_back( "--DEBUG" );
0038     tt.push_back( "--INFO" );
0039     tt.push_back( "--WARNING" );
0040     tt.push_back( "--ERROR" );
0041     tt.push_back( "--FATAL" );
0042 
0043     tt.push_back( "--sysrap trace" );
0044     tt.push_back( "--sysrap verbose" );
0045     tt.push_back( "--sysrap debug" );
0046     tt.push_back( "--sysrap info" );
0047     tt.push_back( "--sysrap warning" );
0048     tt.push_back( "--sysrap error" );
0049     tt.push_back( "--sysrap fatal" );
0050 
0051     tt.push_back( "--SYSRAP trace" );
0052     tt.push_back( "--SYSRAP verbose" );
0053     tt.push_back( "--SYSRAP debug" );
0054     tt.push_back( "--SYSRAP info" );
0055     tt.push_back( "--SYSRAP warning" );
0056     tt.push_back( "--SYSRAP error" );
0057     tt.push_back( "--SYSRAP fatal" );
0058 
0059     tt.push_back( "--SYSRAP TRACE" );
0060     tt.push_back( "--SYSRAP VERBOSE" );
0061     tt.push_back( "--SYSRAP DEBUG" );
0062     tt.push_back( "--SYSRAP INFO" );
0063     tt.push_back( "--SYSRAP WARNING" );
0064     tt.push_back( "--SYSRAP ERROR" );
0065     tt.push_back( "--SYSRAP FATAL" );
0066 
0067 
0068     const char* fallback = "info" ; 
0069     const char* prefix = "SYSRAP" ; 
0070 
0071     for(unsigned j=0 ; j < 2 ; j++)
0072     {
0073 
0074     for(unsigned i=0 ; i < tt.size() ; i++)
0075     {
0076         std::string t = tt[i]; 
0077 
0078         SArgs* a = new SArgs(exe, t.c_str()) ;
0079 
0080         if(SLOG::instance != NULL) SLOG::instance = NULL ; 
0081 
0082         SLOG* pl = j == 0 ?
0083                              new SLOG(a->argc, a->argv, fallback ) 
0084                           :
0085                              new SLOG(a->argc, a->argv, fallback, prefix )
0086                           ; 
0087 
0088         std::stringstream ss ; 
0089         ss << "SLOG(..," << fallback ; 
0090         if(j==1) ss << "," << prefix ;
0091         ss << ")" ;
0092 
0093         std::string label = ss.str();
0094 
0095         std::cout << std::setw(50) << t 
0096                   << std::setw(30) << label
0097                   << std::setw(5) << pl->level 
0098                   << std::setw(10) << pl->name() 
0099                   << std::endl
0100                   ; 
0101     } 
0102     }
0103 }
0104 
0105 
0106 
0107 
0108 
0109 int main(int, char** argv_)
0110 {
0111     const char* exe = argv_[0] ; 
0112     test_arguments(exe); 
0113     
0114     return 0 ; 
0115 }