33 #include "SayReporter.h" 34 #include "TheBESKeys.h" 35 #include "BESInternalError.h" 36 #include "SampleResponseNames.h" 38 SayReporter::SayReporter()
46 throw BESInternalError(
"cannot determine Say log name", __FILE__, __LINE__ ) ;
50 _file_buffer =
new ofstream( _log_name.c_str(), ios::out | ios::app ) ;
51 if( !(*_file_buffer) )
53 string s =
"cannot open Say log file " + _log_name ;;
59 SayReporter::~SayReporter()
71 const time_t sctime = time( NULL ) ;
72 const struct tm *sttime = localtime( &sctime ) ;
74 strftime( zone_name,
sizeof( zone_name ),
"%Z", sttime ) ;
75 char *b = asctime( sttime ) ;
76 *(_file_buffer) <<
"[" << zone_name <<
" " ;
77 for(
register int j = 0; b[j] !=
'\n'; j++ )
78 *(_file_buffer) << b[j] ;
79 *(_file_buffer) <<
"] " ;
83 BESDataHandlerInterface::data_citer i = dhi.data_c().find( SAY_WHAT ) ;
84 if( i != dhi.data_c().end() )
86 say_what = (*i).second ;
88 i = dhi.data_c().find( SAY_TO ) ;
89 if( i != dhi.data_c().end() )
91 say_to = (*i).second ;
92 *(_file_buffer) <<
"\"" << say_what <<
"\" said to \"" << say_to <<
"\"" 107 strm << BESIndent::LMarg <<
"SayReporter::dump - (" 108 << (
void *)
this <<
")" << endl ;
109 BESIndent::Indent() ;
110 strm << BESIndent::LMarg <<
"Say log name: " << _log_name << endl ;
111 BESIndent::UnIndent() ;
exception thrown if inernal error encountered
virtual void dump(ostream &strm) const
dumps information about this object
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
Structure storing information used by the BES to handle the request.
static BESKeys * TheKeys()