1 /* |
|
2 * Copyright (c) 2006-2007 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: A plug-in for silencing the rigning tones. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef LOGGER_H |
|
20 #define LOGGER_H |
|
21 |
|
22 #include <e32debug.h> // RDebug::Print |
|
23 |
|
24 /** |
|
25 * Logging macros, |
|
26 * see silenceactionpluginconst.hrh. |
|
27 */ |
|
28 |
|
29 #ifdef LOGGING_ENABLED |
|
30 |
|
31 #ifndef LOGGING_MODE_FILE |
|
32 |
|
33 #define LOG_1( a ) RDebug::Print( a ) |
|
34 #define LOG_2( a, b ) RDebug::Print( a, b ) |
|
35 #define LOG_3( a, b, c ) RDebug::Print( a, b, c ) |
|
36 #define LOG_RAW( a ) RDebug::RawPrint( a ) |
|
37 #define ENABLE_LOG |
|
38 |
|
39 #else |
|
40 |
|
41 #include <flogger.h> |
|
42 #include <f32file.h> |
|
43 |
|
44 _LIT( KFullPath, "c:\\logs\\silenceplugin\\" ); |
|
45 |
|
46 LOCAL_C void EnableLogging() |
|
47 { |
|
48 RFs fs; |
|
49 TInt err = fs.Connect(); |
|
50 if( err == KErrNone ) |
|
51 { |
|
52 fs.MkDirAll( KFullPath ); |
|
53 } |
|
54 fs.Close(); |
|
55 } |
|
56 |
|
57 _LIT( KDir, "silenceplugin" ); |
|
58 _LIT( KFile, "silence.txt" ); |
|
59 |
|
60 #define LOG_1( a ) RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, a ) |
|
61 #define LOG_2( a, b ) RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, a, b ) |
|
62 #define LOG_3( a, b, c ) RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, a, b, c ) |
|
63 #define LOG_RAW( a ) RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, a ) |
|
64 #define ENABLE_LOG EnableLogging() |
|
65 |
|
66 #endif // LOGGING_MODE_FILE |
|
67 |
|
68 #else |
|
69 |
|
70 #define LOG_1( a ) |
|
71 #define LOG_2( a, b ) |
|
72 #define LOG_3( a, b, c ) |
|
73 #define LOG_RAW( a ) |
|
74 #define ENABLE_LOG |
|
75 |
|
76 #endif // LOGGING_ENABLED |
|
77 |
|
78 #endif // LOGGER_H |
|