mexLog.cpp

Go to the documentation of this file.
00001 
00004 // This file is part of the SaliencyToolbox - Copyright (C) 2006-2007
00005 // by Dirk B. Walther and the California Institute of Technology.
00006 // See the enclosed LICENSE.TXT document for the license agreement. 
00007 // More information about this project is available at: 
00008 // http://www.saliencytoolbox.net
00009 
00010 #include "mexLog.h"
00011 #include <cstdarg>
00012 #include <cstdio>
00013 
00014 #define BUFMAXSIZE 1000
00015 
00016 // ######################################################################
00017 void mexInfo(const char *fmt,...)
00018 {
00019   char buf[BUFMAXSIZE];
00020   va_list ap;
00021   va_start(ap,fmt);
00022   vsnprintf(buf,BUFMAXSIZE,fmt,ap);
00023   va_end(ap);
00024   mexPrintf("%s: %s\n",mexFunctionName(),buf);
00025 }
00026 
00027 // ######################################################################
00028 void mexError(const char *fmt,...)
00029 {
00030   char buf[BUFMAXSIZE];
00031   va_list ap;
00032   va_start(ap,fmt);
00033   vsnprintf(buf,BUFMAXSIZE,fmt,ap);
00034   va_end(ap);
00035   mexPrintf("Error in %s: %s\n",mexFunctionName(),buf);
00036 }
00037 
00038 // ######################################################################
00039 void mexFatal(const char *fmt,...)
00040 {
00041   char buf[BUFMAXSIZE];
00042   va_list ap;
00043   va_start(ap,fmt);
00044   vsnprintf(buf,BUFMAXSIZE,fmt,ap);
00045   va_end(ap);
00046   mexErrMsgTxt(buf);
00047 }
00048 
00049 // ######################################################################
00050 void mexDebug(const char *fmt,...)
00051 {
00052   char buf[BUFMAXSIZE];
00053   va_list ap;
00054   va_start(ap,fmt);
00055   vsnprintf(buf,BUFMAXSIZE,fmt,ap);
00056   va_end(ap);
00057   mexPrintf("%s-debug: %s\n",mexFunctionName(),buf);
00058 }

Generated on Fri Sep 7 13:09:49 2007 for SaliencyToolbox by  doxygen 1.5.2