📄 sesdbg.h
字号:
/****************************************************************************
*
* (c) Copyright 2006 by SCADA Enterprise Solutions Inc
* All rights reserved
*
* NAME:
*
* sesDbg.H -- This is the header file for the sesDbg class.
* This object is specially designed to facilitate
* run-time debugging.
*
* AUTHOR: Wai Tse
*
* DESCRIPTION:
*
* This class allows other objects to write the debug information to
* a file
*
* RESTRICTION:
* The debug level that one can define is ranging from 0 to 9, where
* 0 indicates no debug while 9 indicates to have most detail level
* of debug information.
*
* REVISION HISTORY:
*
* 31-Jan-2006 Wai Tse Created the initial version.
*
***************************************************************************/
#ifndef SESDBG_H
#define SESDBG_H
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include "sesConst.H"
#define DBG_LEVEL_1 1
#define DBG_LEVEL_2 2
#define DBG_LEVEL_3 3
#define DBG_LEVEL_4 4
#define DBG_LEVEL_5 5
#define DBG_LEVEL_6 6
#define DBG_LEVEL_7 7
#define DBG_LEVEL_8 8
#define DBG_LEVEL_9 9
#define MAX_DBG_LEVEL 9 // maximum debug level
#define OPT_TIME 1 // debug option to include time stamp
#define HEX_DATA_PER_LINE 16 // number of hexadecimal data per line
#define APP_NAME_SIZE 32 // size of an application name
#define TMP_STRING_SIZE 80 // size of a temporary string
#define DBG_FILE_NOT_OPEN 0 // debug file is NOT open
#define DBG_FILE_OPEN 1 // debug file is open
class sesDbg
{
public:
sesDbg(const char *appName,
const int dbgLevel,
const char *dbgFileName);
virtual ~sesDbg();
void setDbg(const int dbgLevel, const char *dbgFileName);
void setDbg(const int dbgLevel);
void setDbgLevel(const int dbgLevel);
void logDbg(const int dbgLevel,
const string& dbgMsg);
void logDbg(const int dbgLevel,
const char *dbgMsg);
void logDbg(const char *srcName,
const int dbgLevel,
const string& dbgMsg);
void logDbg(const char *srcName,
const int dbgLevel,
const char *dbgMsg);
void logDbg(const char *srcName,
const int dbgLevel,
const string& dbgMsg,
const int option);
void logDbg(const char *srcName,
const int dbgLevel,
const char *dbgMsg,
const int option);
void logDbg(const int dbgLevel,
const int bufferLength,
const char *dbgMsg);
void logDbg(const char *srcName,
const int dbgLevel,
const int bufferLength,
const char *dbgMsg);
void logDbg(const char *srcName,
const int dbgLevel,
const int bufferLength,
const char *dbgMsg,
const int option);
int getDbgLevel(){return (_dbgLevel);}
private:
void logAppName(const char *srcName, int dbgLevel);
void logTime();
void logDbg(const string& dbgMsg); // log a msg in string format
void logDbg(const char *dbgMsg); // log a msg in char * format
int _dbgLevel, // level of debug set by the user
_dbgFile_open; // set to indicate debug file is opened
char _tmpStr[TMP_STRING_SIZE];// temporary text string
char _appName[APP_NAME_SIZE]; // application name
char _dbgFileName[TMP_STRING_SIZE]; // name of the debug file
ofstream _dbgFile; // output stream file object
};
#endif /*SESDBG_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -