33 inline std::string formattedTime (
const std::string &fmt,
bool universal =
false )
46 m_message(
"" ), m_source(
"UNKNOWN" ), m_format( DEFAULT_FORMAT ),
47 m_time_format(DEFAULT_TIME_FORMAT), m_type(
NIL ),
48 m_fill(
' ' ), m_width( 0 ), m_left( true )
59 m_message( msg ), m_source( src ), m_format( DEFAULT_FORMAT ),
60 m_time_format(DEFAULT_TIME_FORMAT), m_type( type ),
61 m_fill(
' ' ), m_width( 0 ), m_left( true )
72 m_message( msg ), m_source( src ), m_format( DEFAULT_FORMAT ),
73 m_time_format(DEFAULT_TIME_FORMAT), m_type( type ),
74 m_fill(
' ' ), m_width( 0 ), m_left( true )
215 if ( format.empty() )
253 if ( timeFormat.empty() )
268 std::string::const_iterator
i = format.begin();
269 while( i != format.end() ) {
276 if ( i == format.end() )
break;
280 std::string this_format =
"";
289 if ( i == format.end() ) {
307 if ( ! format.empty() ) {
308 const char FORMAT_TYPE = format[ format.length() - 1 ];
309 const std::string FORMAT_PARAM = format.substr( 0, format.length() - 1 );
313 switch( FORMAT_TYPE ) {
315 if ( FORMAT_PARAM.length() == 1 ) {
324 const std::string& timeStr = formattedTime (
m_time_format ) ;
331 const std::string& timeStr = formattedTime (
m_time_format,
true ) ;
346 #define SET(x) case x: level=#x; break
354 case ALWAYS: level=
"SUCCESS";
break;
396 bool only_digits =
true;
397 for( std::string::const_iterator
i = formatArg.begin();
398 i != formatArg.end();
i++ ) {
400 if ( ! isdigit( *
i ) ) {
410 m_width = atoi( formatArg.c_str() );
412 m_width = atoi( formatArg.data() );
427 if (
m_width == 0 ||
m_width == static_cast<int>( text.length() ) ) {
433 if (
m_width < static_cast<int>( text.length() ) ) {
434 newText = text.substr( 0,
m_width );
435 for (
int i = 0, j = newText.length()-1; i < 3 && j >= 0;
i++, j-- )
443 newText.replace( newText.begin(), newText.begin() + text.length(),
444 text.begin(), text.end() );
446 newText.replace( newText.end() - text.length(), newText.end(),
447 text.begin(), text.end() );