backupandrestore/backuptest/ABTester/src/abtesterlog.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2004-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 utilities
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 #include "abtesterlog.h"
       
    22 
       
    23 namespace conn
       
    24 	{
       
    25 	
       
    26 	namespace ABTesterLog 
       
    27 		{
       
    28 		#if (defined(ABT_LOGGING_DEBUG_ONLY) && defined(_DEBUG)) || defined(ABT_LOGGING_DEBUG_AND_RELEASE)
       
    29 		
       
    30         /** The flogger subsystem name 
       
    31 		@internalComponent*/    
       
    32 		_LIT(KLogDirectory,"connect");
       
    33 
       
    34 		/** The component name 
       
    35 		@internalComponent*/
       
    36         _LIT(KLogComponentName, "ABTestClient.txt");
       
    37 
       
    38         /** The maximum length of text that can be logged 
       
    39 		@internalComponent*/                
       
    40 		const TInt KMaxLogText = 0x100;
       
    41 			
       
    42 		
       
    43 		void __Log(TRefByValue<const TDesC> aFmt,...)	
       
    44 	 	/**	Logs a message to FLOGGER and to the UI depending on
       
    45 	 	controlling macros.
       
    46 	 	
       
    47 	 	Note that FLOG macros are probably disabled in release builds, 
       
    48 	 	so we might need to use something else for logging to files
       
    49 		@internalComponent
       
    50 	 	@param aFmt Buffer for logging
       
    51 	 	*/
       
    52 			{
       
    53 			VA_LIST list;
       
    54 		    VA_START(list,aFmt);
       
    55 		    
       
    56 		    TBuf<KMaxLogText> buf;
       
    57 		    buf.FormatList(aFmt,list);   
       
    58 		    
       
    59 		#if defined(ABT_LOGGING_METHOD_FLOGGER)   
       
    60 			RFileLogger::Write(KLogDirectory,KLogComponentName, EFileLoggingModeAppend,buf);
       
    61 		#endif    
       
    62 		    
       
    63 		#if defined(ABT_LOGGING_METHOD_RDEBUG) || defined(ABT_LOGGING_METHOD_UI)
       
    64             
       
    65         	
       
    66             aData.Insert( 0, KLogComponentName );
       
    67 
       
    68             #if defined( ABT_LOGGING_METHOD_UI )
       
    69                 User::InfoPrint( buf );
       
    70             #endif
       
    71         	#if defined( SBE_LOGGING_METHOD_RDEBUG )
       
    72             	RDebug::Print( buf );
       
    73         	#endif
       
    74     	#endif
       
    75 			}
       
    76 		}
       
    77 		#endif
       
    78 	}
       
    79