mmappcomponents/videoplaylistutility/inc/videoplaylistutility_log.h
changeset 32 edd273b3192a
parent 27 cbb1bfb7ebfb
equal deleted inserted replaced
27:cbb1bfb7ebfb 32:edd273b3192a
    13 *
    13 *
    14 * Description:  Debug print macros
    14 * Description:  Debug print macros
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 5 %
    18 // Version : %version: 6 %
    19 
       
    20 
       
    21 
    19 
    22 
    20 
    23 #ifndef VIDEOPLAYLISTUTILITY_LOG_H
    21 #ifndef VIDEOPLAYLISTUTILITY_LOG_H
    24 #define VIDEOPLAYLISTUTILITY_LOG_H
    22 #define VIDEOPLAYLISTUTILITY_LOG_H
       
    23 
    25 
    24 
    26 // INCLUDES
    25 // INCLUDES
    27 #include <e32std.h>
    26 #include <e32std.h>
    28 #include <e32svr.h>
    27 #include <e32svr.h>
    29 #include <e32des16.h>
    28 #include <e32des16.h>
    44 
    43 
    45 
    44 
    46 class TVideoPlaylistUtilityLog : public TDes16Overflow
    45 class TVideoPlaylistUtilityLog : public TDes16Overflow
    47 {
    46 {
    48     public:
    47     public:
       
    48 
    49         inline static void NullLog( TRefByValue<const TDesC16> /*aFmt*/, ... )
    49         inline static void NullLog( TRefByValue<const TDesC16> /*aFmt*/, ... )
    50         {
    50         {
    51         }
    51         }
    52 
    52 
    53         inline static void VideoPlaylistUtilityLog( TRefByValue<const TDesC16> aFmt, ... )
    53         inline static void VideoPlaylistUtilityLog( TRefByValue<const TDesC16> aFmt, ... )
    54         {
    54         {
    55             TBuf< 512 > buffer;
    55             TBuf< 512 > buffer;
    56             
    56 
    57             VA_LIST list;
    57             VA_LIST list;
    58             VA_START( list, aFmt );
    58             VA_START( list, aFmt );
    59             buffer.AppendFormatList( aFmt, list );
    59             buffer.AppendFormatList( aFmt, list );
    60             VA_END(list);
    60             VA_END(list);
    61 
    61 
    74 
    74 
    75         TEnterExitLog( TRefByValue<const TDesC> aFunctionName,
    75         TEnterExitLog( TRefByValue<const TDesC> aFunctionName,
    76                        TRefByValue<const TDesC> aFmt, ... )
    76                        TRefByValue<const TDesC> aFmt, ... )
    77         {
    77         {
    78             iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
    78             iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
    79             
    79 
    80             if ( iFunctionName )
    80             if ( iFunctionName )
    81             {
    81             {
    82                 iFunctionName->Des().Copy(aFunctionName);
    82                 iFunctionName->Des().Copy(aFunctionName);
    83             }
    83             }
    84             
    84 
    85             TBuf< 512 > buffer;
    85             TBuf< 512 > buffer;
    86             
    86 
    87             VA_LIST list;
    87             VA_LIST list;
    88             VA_START( list, aFmt );
    88             VA_START( list, aFmt );
    89             buffer.AppendFormatList( aFmt, list, this );
    89             buffer.AppendFormatList( aFmt, list, this );
    90             VA_END(list);
    90             VA_END(list);
    91 
    91 
    92             RDebug::Print(_L("#VideoPlaylistUtility# --> %S %S"), iFunctionName, &buffer );
    92             RDebug::Print(_L("#VideoPlaylistUtility# --> %S %S"), iFunctionName, &buffer );
    93         }
    93         }
    94         
    94 
    95         TEnterExitLog( TRefByValue<const TDesC> aFunctionName )
    95         TEnterExitLog( TRefByValue<const TDesC> aFunctionName )
    96         {
    96         {
    97             iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
    97             iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
    98             
    98 
    99             if ( iFunctionName )
    99             if ( iFunctionName )
   100             {
   100             {
   101                 iFunctionName->Des().Copy(aFunctionName);
   101                 iFunctionName->Des().Copy(aFunctionName);
   102             }
   102             }
   103 
   103 
   104             RDebug::Print(_L("#VideoPlaylistUtility# --> %S"), iFunctionName );
   104             RDebug::Print(_L("#VideoPlaylistUtility# --> %S"), iFunctionName );
   105         }
   105         }
   106         
   106 
   107         ~TEnterExitLog()
   107         ~TEnterExitLog()
   108         {
   108         {
   109             RDebug::Print(_L("#VideoPlaylistUtility# <-- %S"), iFunctionName );
   109             RDebug::Print(_L("#VideoPlaylistUtility# <-- %S"), iFunctionName );
   110             delete iFunctionName;
   110             delete iFunctionName;
   111         }
   111         }
   112         
   112 
   113     private:
   113     private:
   114         HBufC*    iFunctionName;
   114         HBufC*    iFunctionName;
   115 };
   115 };
       
   116 
   116 
   117 
   117 _LIT(_KVPUErrorInfo, "#VideoPlaylistUtility# Error : error %d file %s line %d");
   118 _LIT(_KVPUErrorInfo, "#VideoPlaylistUtility# Error : error %d file %s line %d");
   118 
   119 
   119 #define VIDEOPLAYLISTUTILITY_S(a) _S(a)
   120 #define VIDEOPLAYLISTUTILITY_S(a) _S(a)
   120 
   121