filemanager/src/inc/fmlogger.h
changeset 14 1957042d8c7e
child 18 edd66bde63a4
child 37 15bc28c9dd51
equal deleted inserted replaced
1:d1daf54a55b5 14:1957042d8c7e
       
     1 /*
       
     2  * Copyright (c) 2009 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  * 
       
    15  * Description:
       
    16  *     The header file of logger
       
    17  */
       
    18 #ifndef FMLOGGER_H
       
    19 #define FMLOGGER_H
       
    20 
       
    21 #define FMLOG_PATH QString( "C:\\data\\fileman.txt" )
       
    22 
       
    23 
       
    24 #include <QString>
       
    25 #include <QFile>
       
    26 #include <QTextStream>
       
    27 
       
    28 class FmLogger
       
    29 {
       
    30 public:
       
    31 
       
    32     static bool log( const QString &log )
       
    33     {
       
    34 #ifdef _DEBUG_LOG_ENABLE_
       
    35         QFile file( FMLOG_PATH );
       
    36         if ( !file.open( QIODevice::WriteOnly | QIODevice::Append ) )
       
    37         {
       
    38             return false;
       
    39         }
       
    40         QTextStream out( &file );
       
    41         out << log;
       
    42         out << "\r\n";
       
    43 #else
       
    44         Q_UNUSED( log );
       
    45 #endif
       
    46         return true;
       
    47     }
       
    48 };
       
    49 
       
    50 #endif