41 #include "uhal/log/log.hpp" 48 template<
typename T >
58 int main (
int argc,
char* argv[] )
63 log (
Notice() ,
"const char*" );
64 log (
Notice() , std::string (
"std::string" ) );
66 log (
Notice() ,
"a" ,
'b' , std::string (
"c" ) ,
"d" ,
"e" ,
"f" ,
"g" ,
"h" ,
"i" ,
"j" ,
"k" ,
"l" ,
"m" ,
"n" ,
"o" ,
"p" ,
"q" ,
"r" ,
"s" ,
"t" ,
"u" ,
"v" ,
"w" ,
"x" ,
"y" ,
"z" ,
"0" ,
"1" ,
"2" ,
"3" ,
"4" ,
"5" );
68 gettimeofday ( &lTime, NULL );
69 log (
Notice() ,
Time ( lTime ) ,
" default formatting" );
70 log (
Notice() ,
Time ( lTime ,
TimeFmt< day,'/',mth,'/',year,' ',hr,':',min,':',sec,'.',usec >() ) ,
" truncated to the nearest usecond" );
71 log (
Notice() ,
Time ( lTime ,
TimeFmt< day,'/',mth,'/',year,' ',hr,':',min,':',sec >() ) ,
" truncated to the nearest second" );
72 log (
Notice() ,
Time ( lTime ,
TimeFmt< day,'/',mth,'/',year,' ',hr,':',min >() ) ,
" truncated to the nearest minute" );
81 log (
Notice() ,
"13 as a decimal uint8 : " ,
Integer ( uint8_t ( 13 ) ) );
82 log (
Notice() ,
"-13 as a decimal int8 : " ,
Integer ( int8_t ( -13 ) ) );
83 log (
Notice() ,
"13 as a decimal uint16 : " ,
Integer ( uint16_t ( 13 ) ) );
84 log (
Notice() ,
"-13 as a decimal int16 : " ,
Integer ( int16_t ( -13 ) ) );
85 log (
Notice() ,
"13 as a decimal uint32 : " ,
Integer ( uint32_t ( 13 ) ) );
86 log (
Notice() ,
"-13 as a decimal int32 : " ,
Integer ( int32_t ( -13 ) ) );
87 log (
Notice() ,
"13 as a decimal uint64 : " ,
Integer ( uint64_t ( 13 ) ) );
88 log (
Notice() ,
"-13 as a decimal int64 : " ,
Integer ( int64_t ( -13 ) ) );
147 exception::FileNotFound lExc;
151 std::cout << lExc.what() << std::endl;
153 setLogLevelTo (
Error() );
154 log (
Notice() , std::string (
"setLogLevelTo ( Error() ) : IF YOU >>DO<< SEE THIS, THEN THERE IS AN ERROR" ) );
155 log (
Error() , std::string (
"setLogLevelTo ( Error() ) : IF YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
156 setLogLevelTo (
Notice() );
157 log (
Notice() , std::string (
"setLogLevelTo ( Notice() ) : IF YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
158 log (
Error() , std::string (
"setLogLevelTo ( Notice() ) : IF YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
161 setLogLevelFromEnvironment (
"UHAL_LOG_LEVEL" );
162 log (
Notice() , std::string (
"setLogLevelFromEnvironment ( \"UHAL_LOG_LEVEL\" ) : IF \"UHAL_LOG_LEVEL\" IS DEFINED ABOVE \"Notice()\" AND YOU >>DO<< SEE THIS, THEN THERE IS AN ERROR" ) );
163 log (
Error() , std::string (
"setLogLevelFromEnvironment ( \"UHAL_LOG_LEVEL\" ) : IF \"UHAL_LOG_LEVEL\" IS NOT DEFINED ABOVE \"Error()\" AND YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
165 log (
Notice() , std::string (
"disableLogging() : IF YOU >>DO<< SEE THIS, THEN THERE IS AN ERROR" ) );
166 log (
Error() , std::string (
"disableLogging() : IF YOU >>DO<< SEE THIS, THEN THERE IS AN ERROR" ) );
168 setLogLevelTo (
Notice() );
169 log (
Notice() , std::string (
"setLogLevelTo ( Notice() ) : IF YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
170 log (
Error() , std::string (
"setLogLevelTo ( Notice() ) : IF YOU DON'T SEE THIS, THEN THERE IS AN ERROR" ) );
172 catch (
const std::exception& aExc )
174 std::cerr <<
"ERROR: Caught Exception : " << aExc.what() << std::endl;
int main(int argc, char *argv[])
_Time< DefaultTimeFmt > Time(const timeval &aTime)
Helper function which wrap the template uglyness in a pretty package.
Empty struct which acts as a dummy variable for passing the formatting information around...
_Quote< T > Quote(const T &aT)
A struct whose template parameters represent a time format.
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...