SWIutilLogger.hpp
上传用户:xqtpzdz
上传日期:2022-05-21
资源大小:1764k
文件大小:4k
源码类别:

xml/soap/webservice

开发平台:

Visual C++

  1. /*****************************************************************************
  2.  *****************************************************************************
  3.  *
  4.  *
  5.  * SWIutilLogger - logging class for SWIutil
  6.  *
  7.  * This provides logging definitions for SWIutil use of VXIlog, along
  8.  * with some convenience macros.
  9.  *
  10.  *****************************************************************************
  11.  ****************************************************************************/
  12. /****************License************************************************
  13.  * Vocalocity OpenVXI
  14.  * Copyright (C) 2004-2005 by Vocalocity, Inc. All Rights Reserved.
  15.  * This program is free software; you can redistribute it and/or
  16.  * modify it under the terms of the GNU General Public License
  17.  * as published by the Free Software Foundation; either version 2
  18.  * of the License, or (at your option) any later version.
  19.  *  
  20.  * This program is distributed in the hope that it will be useful,
  21.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23.  * GNU General Public License for more details.
  24.  *
  25.  * You should have received a copy of the GNU General Public License
  26.  * along with this program; if not, write to the Free Software
  27.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  28.  * Vocalocity, the Vocalocity logo, and VocalOS are trademarks or 
  29.  * registered trademarks of Vocalocity, Inc. 
  30.  * OpenVXI is a trademark of Scansoft, Inc. and used under license 
  31.  * by Vocalocity.
  32.  ***********************************************************************/
  33. /* -----1=0-------2=0-------3=0-------4=0-------5=0-------6=0-------7=0-------8
  34.  */
  35. #ifndef _SWIUTIL_LOGGER_H__
  36. #define _SWIUTIL_LOGGER_H__
  37. #include "SWIutilHeaderPrefix.h"
  38. #include "VXIlog.h"          /* Logging engine */
  39. #include <stdarg.h>          /* For variable argument list */
  40. /* Base class for logging */
  41. class SWIUTIL_API_CLASS SWIutilLogger
  42. {
  43.  protected:
  44.   // Constructor and destructor
  45.   SWIutilLogger(const VXIchar *moduleName, VXIlogInterface *log,
  46. VXIunsigned diagTagBase);
  47.   SWIutilLogger(const SWIutilLogger& logger);
  48.   virtual ~SWIutilLogger();
  49.   // Set the log interface when unavailable at construct time
  50.   void SetLog(VXIlogInterface *log, VXIunsigned diagTagBase);
  51.  public:
  52.   // Accessor
  53.   const VXIchar *GetModuleName() const;
  54.   VXIlogInterface *GetLog() const;
  55.   VXIunsigned GetDiagBase() const;
  56.   VXIbool DiagIsEnabled (VXIunsigned tag) const;
  57.   // Logging methods
  58.   VXIlogResult Error (VXIunsigned errorID, const VXIchar *format, ...) const;
  59.   VXIlogResult Error (VXIlogInterface *log, VXIunsigned errorID,
  60.       const VXIchar *format, ...) const;
  61.   static VXIlogResult Error (VXIlogInterface *log, const VXIchar *moduleName,
  62.      VXIunsigned errorID, const VXIchar *format,
  63.      ...);
  64.   VXIlogResult Diag (VXIunsigned tag, const VXIchar *subtag,
  65.      const VXIchar *format, ...) const;
  66.   VXIlogResult Diag (VXIlogInterface *log, VXIunsigned tag,
  67.      const VXIchar *subtag, const VXIchar *format,
  68.      ...) const;
  69.   static VXIlogResult Diag (VXIlogInterface *log, VXIunsigned diagTagBase,
  70.     VXIunsigned tag, const VXIchar *subtag,
  71.     const VXIchar *format, ...);
  72.   VXIlogResult VDiag (VXIunsigned tag, const VXIchar *subtag,
  73.       const VXIchar *format, va_list args) const;
  74.  private:
  75.   VXIchar*          _moduleName;
  76.   VXIlogInterface  *_log;
  77.   VXIunsigned       _diagTagBase;
  78.   // Disabled assignment operator.
  79.   SWIutilLogger &operator=(const SWIutilLogger &logger);
  80. };
  81. #endif  /* define _SWIUTIL_LOGGER_H__ */