pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsLogger.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Implemented logger functionality of the module
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WIMSECURITYDIALOGS_LOGGER_H
       
    20 #define WIMSECURITYDIALOGS_LOGGER_H
       
    21 
       
    22 #if defined ( _DEBUG )
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #include <flogger.h>
       
    27 
       
    28 // log files are stored to KDebugLogDirFull folder
       
    29 _LIT(KDebugLogDependency,"C:\\Logs\\");
       
    30 _LIT(KDebugLogDoubleBackSlash,"\\");
       
    31 
       
    32 _LIT(KDebugLogDir, "WimSecurityDialogs");
       
    33 _LIT(KDebugLogFile, "WimSecurityDialogsNotifierDebugLog.log");
       
    34 _LIT(KDebugLogTitle, "- BrowserTelServiceNotifier Debug Log File -");
       
    35 _LIT( KWimsecuritydialogsLogMessageAppBanner,   "WimSecurityDialogs: module (%d.%d.%d) started" );
       
    36 _LIT( KDebugLogEnterFn,            "WimSecurityDialogs: -> %S" );
       
    37 _LIT( KDebugLogLeaveFn,            "WimSecurityDialogs: <- %S" );
       
    38 _LIT( KDebugLogTimeFormatString,   "%H:%T:%S:%*C3" );
       
    39 _LIT( KDebugLogExit,               "WimSecurityDialogs: module exit" );
       
    40 
       
    41 
       
    42 // MACROS
       
    43 
       
    44 /**
       
    45 * Use this macro in order to initialize logger :
       
    46 * - create log directory,
       
    47 * - write version information into the log file
       
    48 */
       
    49 #define WIMSECURITYDIALOGS_CREATE { TFileName path( KDebugLogDependency ); path.Append( KDebugLogDir ); path.Append( KDebugLogDoubleBackSlash ); RFs& fs = CEikonEnv::Static()->FsSession(); fs.MkDirAll( path ); RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, EFileLoggingModeOverwrite, KWimsecuritydialogsLogMessageAppBanner ); }
       
    50 
       
    51 /**
       
    52 * Use this macro for writing information about exiting.
       
    53 */
       
    54 #define WIMSECURITYDIALOGS_DELETE { RFileLogger::Write( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, KDebugLogExit ); }
       
    55 
       
    56 /**
       
    57 * Use this function at the entry point of any functions.
       
    58 * @param a Entry information of the method.
       
    59 */
       
    60 #define WIMSECURITYDIALOGS_ENTERFN( a ) { _LIT( temp, a ); RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, KDebugLogEnterFn, &temp ); }
       
    61 
       
    62 /**
       
    63 * Use this function right before you leave the method.
       
    64 * @param a Leaving information of the method.
       
    65 */
       
    66 #define WIMSECURITYDIALOGS_LEAVEFN( a ) { _LIT( temp, a ); RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, KDebugLogLeaveFn, &temp ); }
       
    67 
       
    68 /**
       
    69 * Use this function at any points of a function for logging the current state.
       
    70 * @param a String to be written into logfile about the current state
       
    71 */
       
    72 #define WIMSECURITYDIALOGS_WRITE( a ) { _LIT( temp, a ); RFileLogger::Write( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, temp ); }
       
    73 
       
    74 /**
       
    75 * Use this function at any points of a function for logging the current state.
       
    76 * You can use printf-like formats, but with only one parameter to be substituted..
       
    77 * @param a Format string,
       
    78 * @param b Parameter to be substituted.
       
    79 */
       
    80 #define WIMSECURITYDIALOGS_WRITE_FORMAT( a, b ) { _LIT( temp, a ); RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, temp, b ); }
       
    81 
       
    82 /**
       
    83 * Use this function at any points of a function for logging the current state.
       
    84 * The current date/time stamp is written besides the string you give.
       
    85 * @param a String to be written into logfile about the current state
       
    86 */
       
    87 #define WIMSECURITYDIALOGS_WRITE_TIMESTAMP( a ) { _LIT( temp, a ); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KDebugLogTimeFormatString ); buffer.Insert( 0, temp ); RFileLogger::Write( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, buffer); }
       
    88 
       
    89 
       
    90 #else // _DEBUG
       
    91 
       
    92 // Empty macros
       
    93 #define WIMSECURITYDIALOGS_CREATE
       
    94 #define WIMSECURITYDIALOGS_DELETE
       
    95 #define WIMSECURITYDIALOGS_ENTERFN( a )
       
    96 #define WIMSECURITYDIALOGS_LEAVEFN( a )
       
    97 #define WIMSECURITYDIALOGS_WRITE( a )
       
    98 #define WIMSECURITYDIALOGS_WRITE_FORMAT( a, b )
       
    99 #define WIMSECURITYDIALOGS_WRITE_TIMESTAMP( a )
       
   100 
       
   101 #endif // _DEBUG
       
   102 
       
   103 
       
   104 #endif	// WIMSECURITYDIALOGS_LOGGER_H
       
   105 
       
   106 // End of file