// ---------------------------------------------------------------------- // // ZMexErrorLog.cc - define basic logging behavior to an ErrorLog // // History: // 05-Jan-1999 WEB Initial draft. // 07-Jun-1999 WEB Changed static_cast<> to dynamic_cast<> in emit() // // ---------------------------------------------------------------------- #include "ErrLogEx/ZMexErrorLog.h" #include "ErrorLogger/ErrorLog.h" // ---------------------------------------------------------------------- ZM_BEGIN_NAMESPACE( zmex ) /* namespace zmex { */ ZM_USING_NAMESPACE( zmel ) // ---------------------------------------------------------------------- // --------------- // ZMexErrorLog:: // --------------- ZMexErrorLog::ZMexErrorLog( ErrorLog & log ) : ZMexLogBehavior() , myLog( log ) { ; } ZMexErrorLog::~ZMexErrorLog() { ; } ZM_COVARIANT_TYPE(ZMexLogBehavior,ZMexErrorLog) * ZMexErrorLog::clone() const { return new ZMexErrorLog( *this ); } ZMexLogResult ZMexErrorLog::emit( const ZMexception & x ) { // DEBUG std::cerr << "ZMexErrorLog::emit(..)" << std::endl; // Grab the ErrorObj inside the exception and log it right away: // DEBUG std::cerr << x.logMessage() << std::flush; myLog( dynamic_cast(x).errorObject() ) << endmsg; return ZMexLOGGED; } ZMexLogResult ZMexErrorLog::emit( const std::string & s ) { std::cerr << "ZMexErrorLog::emit( \"" << s << "\" )" << std::endl; return ZMexNOTLOGGED; } // ---------------------------------------------------------------------- ZM_END_NAMESPACE( zmex ) /* } // namespace zmex */