[asterisk-commits] pcadach: branch pcadach/chan_h323-live r42925 -
/team/pcadach/chan_h323-live/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Sep 14 02:23:05 MST 2006
Author: pcadach
Date: Thu Sep 14 04:23:04 2006
New Revision: 42925
URL: http://svn.digium.com/view/asterisk?rev=42925&view=rev
Log:
Use OpenH323's PTrace object which supports locking to provide debugging output
Modified:
team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp?rev=42925&r1=42924&r2=42925&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Thu Sep 14 04:23:04 2006
@@ -74,6 +74,8 @@
static int _timerChangePipe[2];
+static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine;
+
class PAsteriskLog : public PObject, public iostream {
PCLASSINFO(PAsteriskLog, PObject);
@@ -143,7 +145,18 @@
return 0;
}
-#define cout (*logstream)
+static ostream &my_endl(ostream &os)
+{
+ if (logstream) {
+ PTrace::SetOptions(traceOptions);
+ return PTrace::End(os);
+ }
+ return endl(os);
+}
+
+#define cout \
+ (logstream ? (PTrace::ClearOptions((unsigned)-1), PTrace::Begin(0, __FILE__, __LINE__)) : std::cout)
+#define endl my_endl
/* Special class designed to call cleanup code on module destruction */
class MyH323_Shutdown {
@@ -175,7 +188,7 @@
void MyProcess::Main()
{
- PTrace::Initialise(PTrace::GetLevel(), NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
+ PTrace::Initialise(PTrace::GetLevel(), NULL, traceOptions);
PTrace::SetStream(logstream);
cout << " == Creating H.323 Endpoint" << endl;
@@ -1784,6 +1797,7 @@
}
#undef cout
+#undef endl
void h323_end_process(void)
{
if (endPoint) {
More information about the asterisk-commits
mailing list