--- yoda/techmodel/LogReader.cpp 2004/08/19 15:24:46 1.3 +++ yoda/techmodel/LogReader.cpp 2004/09/21 20:50:54 2.0 @@ -1,6 +1,6 @@ /** @file * $Source: /home/cvsmanager/yoda/techmodel/LogReader.cpp,v $ - * $Id: LogReader.cpp,v 1.2 2004/07/17 20:03:38 kusanagi Exp $ + * $Id: LogReader.cpp,v 1.5 2004/09/21 20:24:33 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the LogReader class. @@ -11,7 +11,7 @@ #define UINT unsigned int #define BYTE unsigned char #include -#include +#include extern "C" { #include #include "CRC.h" @@ -26,16 +26,14 @@ using namespace pamela; using namespace pamela::techmodel; -static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.LogReader"); +static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.LogReader")); /** * Constructor. */ LogReader::LogReader(void): TechmodelAlgorithm(PacketType::Log, "TechmodelLogReader") { - cat << log4cpp::Priority::DEBUG - << "Constructor " - << "\n " << log4cpp::CategoryStream::ENDLINE; + logger->debug(_T("Constructor")); Log = new LogEvent(); } @@ -44,7 +42,7 @@ */ std::string LogReader::GetVersionInfo(void) const { return - "$Header: /home/cvsmanager/yoda/techmodel/LogReader.cpp,v 1.2 2004/07/17 20:03:38 kusanagi Exp $\n"; + "$Header: /home/cvsmanager/yoda/techmodel/LogReader.cpp,v 1.5 2004/09/21 20:24:33 kusanagi Exp $\n"; } /** @@ -52,6 +50,7 @@ * event reader routines for all packet types. */ void LogReader::Init(PamelaRun *run) { + logger->debug(_T("Initialize")); SetInputStream(run); run->WriteSubPacket(this, &Log, Log->Class()); } @@ -92,10 +91,12 @@ rec->INFO1 = (((UINT32)subData[offset+8]<<24)&0xFF000000) + (((UINT32)subData[offset+9]<<16)&0x00FF0000) + (((UINT32)subData[offset+10]<<8)&0x0000FF00) + (((UINT32)subData[offset+11])&0x000000FF); offset = offset + 12; } - free(subData); } else { - cat << log4cpp::Priority::ERROR - << "Wrong CRC in Log Packet " - << "\n " << log4cpp::CategoryStream::ENDLINE; + std::stringstream oss; + oss.flush(); + oss << "Wrong CRC on Subpacket internal to Log Packet";// starting at position"; + //<< start; + logger->warn(oss.str().c_str()); } + delete [] subData; }