|
From: <ew...@us...> - 2003-07-12 17:14:13
|
Update of /cvsroot/aedgui/aedGUI/include
In directory sc8-pr-cvs1:/tmp/cvs-serv6384/include
Added Files:
aedLog.h
Log Message:
class for error logging
--- NEW FILE: aedLog.h ---
/*
* The aedLog class
* This class provides a simple logging mechanism for the aed library
* ew...@bl...
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
class aedLog
{
public:
void logWarning(std::stringstream &msg, long lineno = 0, char *fname = "");
void logError(std::stringstream &msg, long lineno = 0, char *fname = "");
void logFatal(std::stringstream &msg, long lineno = 0, char *fname = "");
};
// recommended to use the macros
// This will give file and line number information, easier debugging :)
// example usage....
// AED_LOG_WARNING("fopen failed with errno: " << errno <<
// " Description: " << strerror(errno) << endl);
#define AED_LOG_WARNING(msg) {std::stringstream s;\
s << msg;\
aedLog().logError(s,__LINE__,__FILE__);}
#define AED_LOG_ERR(msg) {std::stringstream s;\
s << msg;\
aedLog().logError(s,__LINE__,__FILE__);}
#define AED_LOG_FATAL(msg) {std::stringstream s;\
s << msg;\
aedLog().logFatal(s,__LINE__,__FILE__);}
|