telephonyserverplugins/ctsydispatchlayer/src/ltsylogger.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 // Logging macros for Tsy. These use the Comms Debug / Flogger V2
       
    15 // Framework.
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23 */
       
    24 
       
    25 #include <ctsy/ltsy/ltsylogger.h>
       
    26 
       
    27 #ifdef _DEBUG
       
    28 #include <e32debug.h>
       
    29 #include <comms-infras/commsdebugutility.h>
       
    30 
       
    31 const TInt KLineLength = 255;
       
    32 
       
    33 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer)
       
    34 /**
       
    35 Constructor: log the function name entry
       
    36 */
       
    37 	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
       
    38 	{
       
    39 	RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8(">>%S"), &iFnName);
       
    40 	};
       
    41 
       
    42 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...)
       
    43 /**
       
    44 Write the function name entry plus plus 8 bits formated list
       
    45 */
       
    46 	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
       
    47 	{
       
    48 	VA_LIST list;
       
    49 	VA_START(list,aFmt);
       
    50 	TBuf8<KLineLength> line;
       
    51 	line.Append(_L8(">>"));
       
    52 	line.Append(iFnName);
       
    53 	line.Append(' ');
       
    54 	line.Append(aFmt);
       
    55 	RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list);
       
    56 	};
       
    57 
       
    58 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...)
       
    59 /**
       
    60 Write the function name entry plus 16 bits formated list
       
    61 */
       
    62 	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
       
    63 	{
       
    64 	VA_LIST list;
       
    65 	VA_START(list,aFmt);
       
    66 
       
    67 	TBuf<KLineLength> line;
       
    68 	line.Copy(iFnName);
       
    69 	line.Insert(0,_L(">>"));
       
    70 	line.Append(' ');
       
    71 	line.Append(aFmt);
       
    72 	RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list);
       
    73 	};
       
    74 			
       
    75 EXPORT_C TLogEntryExit::~TLogEntryExit()
       
    76 /**
       
    77 Write the function name exit
       
    78 */
       
    79 	{
       
    80 	if (iErr == KErrNone)
       
    81 		{
       
    82 		RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S"), &iFnName);
       
    83 		}
       
    84 	else
       
    85 		{
       
    86 		RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S [err=%d]"), &iFnName, iErr);
       
    87 		}
       
    88 	};
       
    89 
       
    90 #else // #ifdef _DEBUG
       
    91 
       
    92 // stub export for urel builds
       
    93 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){};
       
    94 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){};
       
    95 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){};
       
    96 EXPORT_C TLogEntryExit::~TLogEntryExit() {};
       
    97 
       
    98 #endif // #ifdef _DEBUG