diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2001-02-27 17:01:31 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2001-02-27 17:01:31 +0000 |
commit | d7f1e846a804d95b1c241bda1af3ddd1034c18a3 (patch) | |
tree | 06c91384aa01aace46af57e8c5a012c62b9f1acb /bridges | |
parent | 638e1945e5b052a645a118d7c136829ee91f3b5a (diff) |
#
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/remote/urp/urp_bridgeimpl.hxx | 7 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_log.cxx | 77 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_log.hxx | 8 |
3 files changed, 70 insertions, 22 deletions
diff --git a/bridges/source/remote/urp/urp_bridgeimpl.hxx b/bridges/source/remote/urp/urp_bridgeimpl.hxx index f3deb0565a34..b905754eecbe 100644 --- a/bridges/source/remote/urp/urp_bridgeimpl.hxx +++ b/bridges/source/remote/urp/urp_bridgeimpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_bridgeimpl.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jbu $ $Date: 2000-09-29 08:42:05 $ + * last change: $Author: jbu $ $Date: 2001-02-27 18:01:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,7 +139,8 @@ struct urp_BridgeImpl : OWriterThread *m_pWriter; OReaderThread *m_pReader; - FILE *m_pLogFile; + ::rtl::OString m_sLogFileName; + FILE *m_pLogFile; ::osl::Condition m_cndWaitForThreads; struct Properties m_properties; diff --git a/bridges/source/remote/urp/urp_log.cxx b/bridges/source/remote/urp/urp_log.cxx index 5a0ce0f184c3..8f5033b927ca 100644 --- a/bridges/source/remote/urp/urp_log.cxx +++ b/bridges/source/remote/urp/urp_log.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_log.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:28:50 $ + * last change: $Author: jbu $ $Date: 2001-02-27 18:01:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,21 +58,61 @@ * * ************************************************************************/ +#include <osl/time.h> #include "urp_bridgeimpl.hxx" #include "urp_log.hxx" using namespace ::rtl; +using namespace ::osl; namespace bridges_urp { #ifdef BRIDGES_URP_PROT + Mutex g_logFileMutex; + + class FileAccess + { + public: + FileAccess( urp_BridgeImpl *pBridgeImpl_ ) : + pBridgeImpl( pBridgeImpl_ ), + guard( g_logFileMutex ) + { + if( pBridgeImpl->m_pLogFile ) + { + f = pBridgeImpl->m_pLogFile; + } + else + { + f = fopen( pBridgeImpl->m_sLogFileName.getStr() , "a" ); + } + } + ~FileAccess() + { + if( ! pBridgeImpl->m_pLogFile ) + { + fclose( f ); + } + } + FILE *getFile() + { + return f; + } + private: + urp_BridgeImpl *pBridgeImpl; + MutexGuard guard; + FILE *f; + }; + void urp_logCall( urp_BridgeImpl *pBridgeImpl, sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , const ::rtl::OUString &sMethodName ) { - if( pBridgeImpl->m_pLogFile && getenv( "PROT_REMOTE_ACTIVATE" ) ) + if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) { OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); - fprintf( pBridgeImpl->m_pLogFile , - "calling [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n" , + + FileAccess access( pBridgeImpl ); + fprintf( access.getFile() , + "%06d: calling [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n" , + osl_getGlobalTimer(), nSize, nUseData, bSynchron, sOperation.pData->buffer ); } } @@ -81,18 +121,20 @@ namespace bridges_urp sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , const ::rtl::OUString &sMethodName ) { - if( pBridgeImpl->m_pLogFile && getenv( "PROT_REMOTE_ACTIVATE" ) ) + if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) { OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); + + FileAccess access( pBridgeImpl ); fprintf( - pBridgeImpl->m_pLogFile, - "serving request [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n", + access.getFile(), + "%06d: serving request [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n", + osl_getGlobalTimer(), nSize, nUseData, bSynchron, sOperation.pData->buffer ); - } } @@ -100,11 +142,13 @@ namespace bridges_urp sal_Int32 nSize, sal_Int32 nUseData, const ::rtl::OUString &sMethodName ) { - if( pBridgeImpl->m_pLogFile && getenv( "PROT_REMOTE_ACTIVATE" ) ) + if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) { OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); - fprintf( pBridgeImpl->m_pLogFile, - "getting reply [size=%d(usedata=%d)][name=%s]\n" , + FileAccess access( pBridgeImpl ); + fprintf( access.getFile(), + "%06d: getting reply [size=%d(usedata=%d)][name=%s]\n" , + osl_getGlobalTimer(), nSize, nUseData, sOperation.pData->buffer); } @@ -114,11 +158,14 @@ namespace bridges_urp sal_Int32 nSize , sal_Int32 nUseData, const ::rtl::OUString &sMethodName ) { - if( pBridgeImpl->m_pLogFile && getenv( "PROT_REMOTE_ACTIVATE" ) ) + if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) { OString sOperation = OUStringToOString(sMethodName,RTL_TEXTENCODING_ASCII_US); - fprintf( pBridgeImpl->m_pLogFile, - "replying [size=%d(usedata=%d)] [name=%s]\n", + + FileAccess access( pBridgeImpl ); + fprintf( access.getFile(), + "%06d: replying [size=%d(usedata=%d)] [name=%s]\n", + osl_getGlobalTimer(), nSize, nUseData, sOperation.pData->buffer); } diff --git a/bridges/source/remote/urp/urp_log.hxx b/bridges/source/remote/urp/urp_log.hxx index aec94b9f9eff..172318c01970 100644 --- a/bridges/source/remote/urp/urp_log.hxx +++ b/bridges/source/remote/urp/urp_log.hxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_log.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2000-11-28 14:42:38 $ + * last change: $Author: jbu $ $Date: 2001-02-27 18:01:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,9 +60,9 @@ ************************************************************************/ namespace bridges_urp { -#ifndef PRODUCT +// #ifndef PRODUCT #define BRIDGES_URP_PROT -#endif +// #endif #ifdef BRIDGES_URP_PROT void urp_logCall( urp_BridgeImpl *pBridgeImpl , |