connectionmonitoring/connmonext/inc/log.h
changeset 0 5a93021fdf25
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Writes log entries for Connection Monitor Extension.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CONNECTIONMONITOREXTLOG_H
       
    19 #define CONNECTIONMONITOREXTLOG_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 
       
    24 #ifdef _DEBUG
       
    25     #define LOG(a) a
       
    26 #else
       
    27     #define LOG(a)
       
    28 #endif
       
    29 
       
    30 #ifdef _DEBUG
       
    31 
       
    32 #include <flogger.h>
       
    33 
       
    34 _LIT( KLogFolder,"ConnMonExt" );
       
    35 _LIT( KLogFile,"ConnMonExt.txt" );
       
    36 
       
    37 class Log
       
    38     {
       
    39 public:
       
    40     static inline void Write( const TDesC& aDes);
       
    41     static inline void Printf( TRefByValue<const TDesC> aFmt, ...);
       
    42     static inline void Printf( TRefByValue<const TDesC8> aFmt, ...);
       
    43     static inline void HexDump(
       
    44             const TText* aHeader,
       
    45             const TText* aMargin,
       
    46             const TUint8* aPtr,
       
    47             TInt aLen );
       
    48     };
       
    49 
       
    50 inline void Log::Write( const TDesC& aDes )
       
    51     {
       
    52     RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aDes );
       
    53     }
       
    54 
       
    55 inline void Log::Printf( TRefByValue<const TDesC> aFmt, ... )
       
    56     {
       
    57     VA_LIST list;
       
    58     VA_START(list,aFmt);
       
    59     RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
       
    60     }
       
    61 
       
    62 inline void Log::Printf( TRefByValue<const TDesC8> aFmt, ... )
       
    63     {
       
    64     VA_LIST list;
       
    65     VA_START( list,aFmt );
       
    66     RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
       
    67     }
       
    68 
       
    69 inline void Log::HexDump(
       
    70         const TText* aHeader,
       
    71         const TText* aMargin,
       
    72         const TUint8* aPtr,
       
    73         TInt aLen )
       
    74     {
       
    75     RFileLogger::HexDump(
       
    76             KLogFolder(),
       
    77             KLogFile(),
       
    78             EFileLoggingModeAppend,
       
    79             aHeader,
       
    80             aMargin,
       
    81             aPtr,
       
    82             aLen );
       
    83     }
       
    84 
       
    85 #endif // _DEBUG
       
    86 #endif // CONNECTIONMONITOREXTLOG_H
       
    87 
       
    88 // End-of-file