|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of cell supervisor class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <flogger.h> |
|
20 #include "lbtloggerimpl.h" |
|
21 |
|
22 // STATIC |
|
23 CLbtLoggerImpl* CLbtLoggerImpl::iSelf = NULL; |
|
24 |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 EXPORT_C CLbtLoggerImpl* CLbtLoggerImpl::CreateLogger() |
|
29 { |
|
30 if(!iSelf) |
|
31 { |
|
32 CLbtLoggerImpl* impl = NULL; |
|
33 TRAPD( error, impl = new (ELeave) CLbtLoggerImpl() ); |
|
34 if( error != KErrNone ) |
|
35 { |
|
36 iSelf = NULL; |
|
37 return NULL; |
|
38 } |
|
39 iSelf = impl; |
|
40 } |
|
41 return iSelf; |
|
42 } |
|
43 |
|
44 EXPORT_C void CLbtLoggerImpl::Destroy() |
|
45 { |
|
46 delete iSelf; |
|
47 iSelf = NULL; |
|
48 } |
|
49 |
|
50 EXPORT_C RFileLogger& CLbtLoggerImpl::GetFileLogger() |
|
51 { |
|
52 return iLogger; |
|
53 } |
|
54 |
|
55 CLbtLoggerImpl::CLbtLoggerImpl() |
|
56 { |
|
57 TInt error; |
|
58 error = iLogger.Connect(); |
|
59 if(error == KErrNone) |
|
60 { |
|
61 _LIT16(filename,"lbt"); |
|
62 TBuf16<40> buffer( filename ); |
|
63 TTime currentTime; |
|
64 currentTime.HomeTime(); |
|
65 TDateTime currentDateTime = currentTime.DateTime(); |
|
66 buffer.AppendNum( currentDateTime.Day()+ 1 ); |
|
67 buffer.Append('_'); |
|
68 buffer.AppendNum( currentDateTime.Month()+1); |
|
69 buffer.Append('_'); |
|
70 buffer.AppendNum(currentDateTime.Hour()); |
|
71 buffer.Append('_'); |
|
72 buffer.AppendNum(currentDateTime.Minute()); |
|
73 buffer.Append('_'); |
|
74 buffer.AppendNum(currentDateTime.Second()); |
|
75 buffer.Append(_L(".log")); |
|
76 |
|
77 iLogger.CreateLog(_L("epos"), buffer, EFileLoggingModeAppend); |
|
78 iLogger.SetDateAndTime(ETrue, ETrue); |
|
79 } |
|
80 } |
|
81 |
|
82 CLbtLoggerImpl::~CLbtLoggerImpl() |
|
83 { |
|
84 iLogger.CloseLog(); |
|
85 iLogger.Close(); |
|
86 } |
|
87 |
|
88 |
|
89 // end of file |
|
90 |
|
91 |