You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2003/07/01 06:45:01 UTC

cvs commit: xml-axis/c/src/common Debug.cpp Debug.h AxisLog.cpp AxisLog.h

damitha     2003/06/30 21:45:01

  Modified:    c/src/common Debug.h
  Added:       c/src/common Debug.cpp
  Removed:     c/src/common AxisLog.cpp AxisLog.h
  Log:
  
  
  Revision  Changes    Path
  1.2       +21 -15    xml-axis/c/src/common/Debug.h
  
  Index: Debug.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Debug.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Debug.h	25 Jun 2003 07:11:19 -0000	1.1
  +++ Debug.h	1 Jul 2003 04:45:01 -0000	1.2
  @@ -1,22 +1,28 @@
  -#ifndef __DEBUG_H_INCLUDED_
  -#define __DEBUG_H_INCLUDED_
  +#ifndef __AXISLOG_H_INCLUDED_
  +#define __AXISLOG_H_INCLUDED_
   
  -#include "AxisLog.h"
  -//#include <string>
  +#include "GDefine.h"
  +#include <list>
  +#include <string>
  +#include <fstream>
   
  +#define DEBUG
  +extern unsigned char chEBuf[1024];
   using namespace std;
  +class Debug
  +{
  +public:
  +	Debug();
  +	virtual ~Debug();
  +  string sFileName;
  +  const char * FileName;
  +  ofstream* fout;
   
  -#define DEBUG
  +  int debug(const string &sLog);
  +  int debug(const string &sLog1, const string &sLog2);
   
  -#define DEBUG_INCLUDE extern unsigned char chEBuf[1024];
  +};
   
  -#define DEBUG_ONE_PARA_LEVEL(X) \
  -sprintf((char*)chEBuf,X); \
  -objAxisLog.writeLog(X);
  -
  -#define DEBUG_TWO_PARA_LEVEL(X,Y) \
  -sprintf((char*)chEBuf,X,Y); \
  -objAxisLog.writeLog(X,Y);	
  -//objAxisLog.writeLog(X);
  +static Debug debugger;
   
  -#endif
  +#endif
  \ No newline at end of file
  
  
  
  1.1                  xml-axis/c/src/common/Debug.cpp
  
  Index: Debug.cpp
  ===================================================================
                                                                                      //////////////////////////////////////////////////////////////////////
  #include "Debug.h"
  #include <time.h>
  
  using namespace std;
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  
  Debug::Debug()
  {
    sFileName = "/usr/local/axiscpp/axis/logs/Debug";
    if(!sFileName.empty())
    {
      FileName = sFileName.c_str();
      fout = new ofstream(FileName,ios::app);  // open for writing
    }
  }
  
  Debug::~Debug()
  {
    fout->close();
    fout = NULL;
  }
  
  int Debug::debug(const string &sLog)
  {
    if(fout)
    {
      time_t ltime;
      time(&ltime);
      *fout << "time:" << ctime(&ltime) << ":" << sLog.c_str() << endl;
      sprintf((char*)chEBuf,sLog.c_str());
      return SUCCESS;
    }
    else
    {
      return FAIL;
    }
  }
  
  int Debug::debug(const string &sLog1, const string &sLog2)
  {
    if(fout)
    {
      time_t ltime;
      time(&ltime);
      *fout << "time:" << ctime(&ltime) << ":" << sLog1.c_str() << " " << sLog2.c_str() << endl;
      sprintf((char*)chEBuf,sLog1.c_str(), sLog2.c_str());
      return SUCCESS;
    }
    else
    {
      return FAIL;
    }
  }
  
  /*
  int main(int argc, char* argv[])
  {
    debugger.debug("damitha");
    return 0;
  }
  */