commsfwsupport/commselements/serverden/src/sd_log.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "sd_log.h"
       
    17 #include "sd_apiextensionipc.h"
       
    18 
       
    19 #include <rscommon.h>
       
    20 
       
    21 using namespace Den;
       
    22 
       
    23 EXPORT_C void Logging::Printf(
       
    24 #ifdef SYMBIAN_TRACE_ENABLE
       
    25 	TInt aWorkerId, const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, ...)
       
    26 #else
       
    27 	TInt, const TDesC8&, TRefByValue<const TDesC8>, ...)
       
    28 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    29 	{
       
    30 #ifdef SYMBIAN_TRACE_ENABLE
       
    31 	VA_LIST list;
       
    32 	VA_START(list,aFmt);
       
    33 	Printf(aWorkerId, aSubTag, Logging::ELogInfo, aFmt, list);
       
    34 	VA_END(list);
       
    35 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    36 	}
       
    37 
       
    38 EXPORT_C void Logging::Printf(
       
    39 #ifdef SYMBIAN_TRACE_ENABLE
       
    40 	TInt aWorkerId, const TDesC8& aSubTag, TLogEntryType aType, TRefByValue<const TDesC8> aFmt, ...)
       
    41 #else
       
    42 	TInt, const TDesC8&, TLogEntryType, TRefByValue<const TDesC8>, ...)
       
    43 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    44 	{
       
    45 #ifdef SYMBIAN_TRACE_ENABLE
       
    46 	VA_LIST list;
       
    47 	VA_START(list,aFmt);
       
    48 	Printf(aWorkerId, aSubTag, aType, aFmt, list);
       
    49 	VA_END(list);
       
    50 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    51 	}
       
    52 
       
    53 EXPORT_C void Logging::Printf(
       
    54 #ifdef SYMBIAN_TRACE_ENABLE
       
    55 	TInt aWorkerId, const TDesC8& /*aSubTag*/, TLogEntryType aType, TRefByValue<const TDesC8> aFmt, VA_LIST& aList)
       
    56 #else
       
    57 	TInt, const TDesC8&, TLogEntryType, TRefByValue<const TDesC8>, VA_LIST&)
       
    58 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    59 /**
       
    60 Write a mulitple argument list to the log, trapping and ignoring any leave
       
    61 
       
    62 */
       
    63 	{
       
    64 #ifdef SYMBIAN_TRACE_ENABLE
       
    65 	TLogTextBuf buf;
       
    66 	_LIT8(KWorkerIdFormat, "W%d: ");
       
    67 	buf.Format(KWorkerIdFormat, aWorkerId);
       
    68 	buf.AppendFormatIgnoreOverflow(aFmt, aList);
       
    69 	UTracePfAny(KPrimaryFilter, aType, ETrue, EFalse, buf.Length(), buf.Ptr(), buf.Length());
       
    70 #endif //#ifdef SYMBIAN_TRACE_ENABLE
       
    71 	}
       
    72 
       
    73 const TText8* Logging::IPCMessName(TInt aMess)
       
    74 /**
       
    75 Write a mulitple argument list to the log, trapping and ignoring any leave
       
    76 */
       
    77 	{
       
    78 	switch(aMess)
       
    79 		{
       
    80 		/*case RootServer::ESSNumProtocols: return _S8("ESSNumProtocols");
       
    81 
       
    82 		*/
       
    83 		
       
    84 		case EIpcSubSessionApiExtIfaceOpen: return _S8("EIpcSubSessionApiExtIfaceOpen");
       
    85 		case EIpcSubSessionApiExtIfaceSend: return _S8("EIpcSubSessionApiExtIfaceSend");
       
    86 		case EIpcSubSessionApiExtIfaceSendReceive: return _S8("EIpcSubSessionApiExtIfaceSendReceive");
       
    87 		case EIpcSubSessionApiExtIfaceClose: return _S8("EIpcSubSessionApiExtIfaceClose");
       
    88 		case EIpcSessionApiExtIfaceOpen: return _S8("EIpcSessionApiExtIfaceOpen");
       
    89 		case EIpcSessionApiExtIfaceSend: return _S8("EIpcSessionApiExtIfaceSend");
       
    90 		case EIpcSessionApiExtIfaceSendReceive: return _S8("EIpcSessionApiExtIfaceSendReceive");
       
    91 		case EIpcSessionApiExtIfaceClose: return _S8("EIpcSessionApiExtIfaceClose");
       
    92 
       
    93 		case RootServer::RSIsCallerConfigurator: return _S8("RSIsCallerConfigurator");
       
    94 		case RootServer::RSLoadModule: return _S8("RSLoadModule");
       
    95 		case RootServer::RSUnloadModule: return _S8("RSUnloadModule");
       
    96 		case RootServer::RSBind: return _S8("RSBind");
       
    97 		case RootServer::RSUnbind: return _S8("RSUnbind");
       
    98 		case RootServer::RSGetModuleInfo: return _S8("RSGetModuleInfo");
       
    99 		case RootServer::RSEnumerateModules: return _S8("RSEnumerateModules");
       
   100 		case RootServer::RSEnumerateSubModules: return _S8("RSEnumerateSubModules");
       
   101 		case RootServer::RSEnumerateBindings: return _S8("RSEnumerateBindings");
       
   102 		case RootServer::RSCancelLoadModule: return _S8("RSCancelLoadModule");
       
   103 		case RootServer::RSCancelUnloadModule: return _S8("RSCancelUnloadModule");
       
   104 		case RootServer::RSCancelBind: return _S8("RSCancelBind");
       
   105 		case RootServer::RSCancelUnbind: return _S8("RSCancelUnbind");
       
   106 		case RootServer::RSCloseSession: return _S8("RSCloseSession");
       
   107 		case RootServer::RSShutdown: return _S8("RSShutdown");
       
   108 		case RootServer::RSSendMessage: return _S8("RSSendMessage");
       
   109 		case RootServer::RSDbgMarkHeap: return _S8("RSDbgMarkHeap");
       
   110 		case RootServer::RSDbgCheckHeap: return _S8("RSDbgCheckHeap");
       
   111 		case RootServer::RSDbgMarkEnd: return _S8("RSDbgMarkEnd");
       
   112 		case RootServer::RSDbgFailNext: return _S8("RSDbgFailNext");
       
   113 
       
   114 		default:
       
   115 			break;
       
   116 //			__DEBUGGER();
       
   117 
       
   118 			/* Don't panic, do read on - you've hit this breakpoint because
       
   119 			aMess has no helpful explananatory text for logging. Almost certainly
       
   120 			this means an IPC function was added without updating this switch. Do
       
   121 			it now and make the world very slightly better!
       
   122 			*/
       
   123 		}
       
   124 	return _S8("Unknown"); 	// unknown
       
   125 	}
       
   126 
       
   127 void Logging::IPCMessName(TInt aMessNum, TDes8& aMessBuf)
       
   128 	{
       
   129 	const TText8* mess = IPCMessName(aMessNum);
       
   130 	if (mess == NULL)
       
   131 		{
       
   132 		_LIT8(KUnknown, "IPC %d (UNKNOWN NAME - edit IPCMessName())");
       
   133 		aMessBuf.Format(KUnknown(), aMessNum);
       
   134 		}
       
   135 	else
       
   136 		{
       
   137 		aMessBuf.Copy(mess);
       
   138 		}
       
   139 	}
       
   140 
       
   141