33#include "SayReporter.h"
34#include "TheBESKeys.h"
35#include "BESInternalError.h"
36#include "SampleResponseNames.h"
38SayReporter::SayReporter() :
43 if (_log_name ==
"") {
47 _file_buffer =
new ofstream(_log_name.c_str(), ios::out | ios::app);
48 if (!(*_file_buffer)) {
49 string s =
"cannot open Say log file " + _log_name;
56SayReporter::~SayReporter()
66 const time_t sctime = time( NULL);
67 const struct tm *sttime = localtime(&sctime);
69 strftime(zone_name,
sizeof(zone_name),
"%Z", sttime);
70 char *b = asctime(sttime);
71 *(_file_buffer) <<
"[" << zone_name <<
" ";
72 for (
register int j = 0; b[j] !=
'\n'; j++)
73 *(_file_buffer) << b[j];
74 *(_file_buffer) <<
"] ";
78 BESDataHandlerInterface::data_citer i = dhi.data_c().find( SAY_WHAT);
79 if (i != dhi.data_c().end()) {
80 say_what = (*i).second;
82 i = dhi.data_c().find( SAY_TO);
83 if (i != dhi.data_c().end()) {
85 *(_file_buffer) <<
"\"" << say_what <<
"\" said to \"" << say_to <<
"\"" << endl;
98 strm << BESIndent::LMarg <<
"SayReporter::dump - (" << (
void *)
this <<
")" << endl;
100 strm << BESIndent::LMarg <<
"Say log name: " << _log_name << endl;
101 BESIndent::UnIndent();
Structure storing information used by the BES to handle the request.
exception thrown if internal error encountered
virtual void dump(std::ostream &strm) const
dumps information about this object
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
static TheBESKeys * TheKeys()
Access to the singleton.