testexecmgmt/ucc/Source/MobileTermination/CLog.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-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 * Description:  
       
    15 * CLog
       
    16 * Log class used by the MT. All objects use the same instance.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __CLOG_H__
       
    23 #define __CLOG_H__
       
    24 
       
    25 /*******************************************************************************
       
    26  *
       
    27  * System Includes
       
    28  *
       
    29  ******************************************************************************/
       
    30 #include <stdio.h>
       
    31 #include <vector>
       
    32 using namespace std;
       
    33 
       
    34 
       
    35 /*******************************************************************************
       
    36  *
       
    37  * Definitions
       
    38  *
       
    39  ******************************************************************************/
       
    40 #define MAXWHOSIZE	(128)
       
    41 #define MAXMSGSIZE	(256)
       
    42 
       
    43 
       
    44 /*******************************************************************************
       
    45  *
       
    46  * Types
       
    47  *
       
    48  ******************************************************************************/
       
    49 typedef enum
       
    50 {
       
    51 	SV_INFO			= 1,
       
    52 	SV_WARNING		= 2,
       
    53 	SV_ERROR		= 4,
       
    54 	SV_RESOURCE		= 8,
       
    55 	SV_STATE		= 16,
       
    56 } TSeverity;
       
    57 
       
    58 typedef struct {
       
    59 	TSeverity iSeverity;
       
    60 	char iWho[MAXWHOSIZE];
       
    61 	char iMsg[MAXMSGSIZE];
       
    62 } TLogEntry;
       
    63 
       
    64 
       
    65 /*******************************************************************************
       
    66  *
       
    67  * Class Definition
       
    68  *
       
    69  ******************************************************************************/
       
    70 class CLog
       
    71 {
       
    72 public:
       
    73 	CLog( int aFileBacked = 0 );
       
    74 	void WriteLogEntry( TSeverity aSeverity, char *aWho, char *aMsg );
       
    75 	void WriteLogEntry( TSeverity aSeverity, char *aWho, char *aErrorLocation, int aErrorA, int aErrorB );
       
    76 	void SetLogLevel( int aLogVector );
       
    77 	char *GetSeverityString( TSeverity aSeverity );
       
    78 	int CalculateLogSize();
       
    79 	void PrintLogToBuffer( int aBufferSize, char *aBuffer );
       
    80 
       
    81 private:
       
    82 	FILE *iLogFile;
       
    83 	int iLogVector;
       
    84 	vector<TLogEntry> iLogEntries;
       
    85 };
       
    86 
       
    87 #endif //__CLOG_H__