Back to home page

EIC code displayed by LXR

 
 

    


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

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 // om-;TEST=PLogTest om-t
0021 
0022 #include <plog/Log.h>
0023 #include <plog/Init.h>
0024 
0025 #include <plog/Formatters/MessageOnlyFormatter.h>
0026 #include <plog/Formatters/FuncMessageFormatter.h>
0027 #include <plog/Formatters/TxtFormatter.h>
0028 #include <plog/Formatters/CsvFormatter.h>
0029 
0030 #include <plog/Appenders/ColorConsoleAppender.h>
0031 
0032 // translate from boost log levels to plog  ... but this are dangerous
0033 // Better to do using plog::verbose etc...
0034 
0035 #define fatal plog::fatal
0036 #define error plog::error
0037 #define warning plog::warning
0038 #define info plog::info
0039 #define debug plog::debug
0040 #define trace plog::verbose
0041 
0042 using namespace plog ; 
0043 
0044 
0045 
0046 
0047 int main(int, char** argv)
0048 {
0049     //typedef plog::MessageOnlyFormatter FMT ; 
0050     typedef plog::FuncMessageFormatter FMT ;     // useful for log comparisons
0051     //typedef plog::TxtFormatter         FMT ;   // this the default full format 
0052     //typedef plog::CsvFormatter         FMT ; 
0053 
0054     static plog::ColorConsoleAppender<FMT> consoleAppender;
0055     plog::init(plog::verbose, &consoleAppender);
0056 
0057     //plog::init(plog::debug, "PLogTest.txt");
0058 
0059 /*
0060     LOG(plog::fatal) << argv[0]  ;
0061     LOG(plog::error) << argv[0]  ;
0062     LOG(plog::warning) << argv[0]  ;
0063     LOG(plog::info) << argv[0]  ;
0064     LOG(plog::debug) << argv[0]  ;
0065     LOG(plog::verbose) << argv[0]  ;
0066 */
0067 
0068     LOG(fatal) << argv[0]  ;
0069     LOG(error) << argv[0]  ;
0070     LOG(warning) << argv[0]  ;
0071     LOG(info) << argv[0]  ;
0072     LOG(debug) << argv[0]  ;
0073     LOG(trace) << argv[0]  ;
0074 
0075 
0076     // if(1) LOG(info) << argv[0] << " if-LOG can can cause dangling else problem with some versions of plog " ;
0077     LOG_IF(info, 1 ) << argv[0] << " this does same as above line and avoids dangling else warning " ; 
0078 
0079 
0080     int ilevel = info ; 
0081     plog::Severity level = info ; 
0082 
0083     LOG(level) << "gello " ; 
0084     LOG((plog::Severity)ilevel) << "i-gello " ; 
0085 
0086     std::cout << " (int)fatal   " << (int)fatal << std::endl ;  
0087     std::cout << " (int)error   " << (int)error << std::endl ;  
0088     std::cout << " (int)warning " << (int)warning << std::endl ;  
0089     std::cout << " (int)info    " << (int)info << std::endl ;  
0090     std::cout << " (int)debug   " << (int)debug << std::endl ;  
0091     std::cout << " (int)verbose " << (int)verbose << std::endl ;  
0092 
0093 
0094 
0095 
0096     return 0 ; 
0097 }
0098 
0099 // om-;TEST=PLogTest om-t 
0100