locationsystemui/locationsysui/possettings/possettingsplugin/src/apilogger.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2010 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:  This class provides function that help in logging entry and exit of APIs of classes
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "apilogger.h"
       
    20 #include <qdatetime.h>
       
    21 
       
    22 const char* debugFileName("c://logs//lbs//posSettingsEngineLog.txt");
       
    23 ofstream logfile;
       
    24 
       
    25 void ApiLogger::OpenLogFile() 
       
    26 {   
       
    27     logfile.open(debugFileName, ios::app);   
       
    28 }
       
    29 
       
    30 void ApiLogger::CloseLogFile() 
       
    31 {
       
    32     logfile.flush();
       
    33     logfile.close();
       
    34 }
       
    35 
       
    36 void ApiLogger::MyOutputHandler(QtMsgType type, const char *msg) 
       
    37 {    
       
    38     switch (type) {
       
    39         case QtDebugMsg:
       
    40             logfile << QTime::currentTime().toString().toAscii().data() << " Debug: " << msg << "\n";            
       
    41             break;
       
    42         case QtCriticalMsg:
       
    43             logfile << QTime::currentTime().toString().toAscii().data() << " Critical: " << msg << "\n";
       
    44             break;
       
    45         case QtWarningMsg:
       
    46            // logfile << QTime::currentTime().toString().toAscii().data() << " Warning: " << msg << "\n";
       
    47             break;
       
    48         case QtFatalMsg:
       
    49             logfile << QTime::currentTime().toString().toAscii().data() << " Fatal: " << msg << "\n";
       
    50         default:
       
    51             break;
       
    52     }
       
    53     logfile.flush();
       
    54 }