2004-03-20 Gernot Hillier <gernot@hillier.de>

* src/application/pythonscript.h: extend prefix() so that it can
          create a short prefix, too; use short prefix for Python traceback 
          (fixes bug #63, reported anonymously)
        * src/application/pythonscript.cpp: Likewise.



git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@284 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
gernot 2004-03-20 11:15:01 +00:00
parent afbe12ee88
commit c621d21748
4 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-03-20 Gernot Hillier <gernot@hillier.de>
* src/application/pythonscript.h: extend prefix() so that it can create
a short prefix, too; use short prefix for Python traceback (fixes bug
#63, reported anonymously)
* src/application/pythonscript.cpp: Likewise.
2004-03-09 Hartmut Goebel <h.goebel@crazy-compilers.com>
* src/application/idlescript.cpp: Reduced delay until
idlescript.py is called the first time after startup.

2
NEWS
View File

@ -1,6 +1,8 @@
0.5 (CVS nn):
=============
* core: use shorter, more readable format for Python traceback logging
* documentation: 5 man pages are now also created: capisuite(8),
capisuite.conf(5), fax.conf(5), answering_machine.conf(5),
capisuitefax(1) (fixes bug #13, thx to Achim Bohnet for reporting)

View File

@ -32,13 +32,16 @@ PythonScript::~PythonScript()
}
string
PythonScript::prefix()
PythonScript::prefix(bool verbose)
{
stringstream s;
time_t t=time(NULL);
char* ct=ctime(&t);
ct[24]='\0';
s << ct << " Pythonscript " << filename << "," << functionname << "," << hex << this << ": ";
if (verbose)
s << ct << " Pythonscript " << filename << "," << functionname << "," << hex << this << ": ";
else
s << ct << " Pythonscript " << hex << this << ": ";
return (s.str());
}
@ -102,11 +105,11 @@ PythonScript::run() throw (ApplicationError)
throw ApplicationError("unable to convert traceback to char*","PythonScript::run()");
error << prefix() << "A python error occured. See traceback below." << endl;
error << prefix() << "Python traceback: ";
error << prefix(false) << "Python traceback: ";
for (int i=0;i<length-1;i++) {
error << traceback[i];
if (traceback[i]=='\n')
error << prefix() << "Python traceback: ";
error << prefix(false) << "Python traceback: ";
}
error << endl;

View File

@ -69,11 +69,12 @@ class PythonScript
*/
virtual void final();
/** @brief return a prefix containing this pointer and date for log messages
/** @brief return a prefix containing this pointer, Python script name and date for log messages
@param verbose controls verbosity, default is true which means to log filename etc., false means only this pointer
@return constructed prefix as stringstream
*/
string prefix();
string prefix(bool verbose=true);
string filename, ///< name of the python script to read
functionname; ///< name of the function to call