1 karl 1.6 //%2003////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.6 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
|
7 mike 1.2 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
|
14 kumpf 1.4 //
|
15 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Sushma Fernandes, Hewlett-Packard Company (sushma_fernandes@hp.com)
27 //
28 // Modified By:
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32
33 #ifndef Pegasus_TraceFileHandler_h
34 #define Pegasus_TraceFileHandler_h
35
36 mike 1.2 #include <cstdarg>
37 #include <cstdio>
38 #include <Pegasus/Common/String.h>
|
39 kumpf 1.5 #include <Pegasus/Common/Linkage.h>
|
40 mike 1.2
|
41 mike 1.3 // REVIEW: are tracing and logging facilities redundant?
42
|
43 mike 1.2 PEGASUS_NAMESPACE_BEGIN
44
45 /** TraceFileHandler implements logging of messages to file
46 */
47
48 class PEGASUS_COMMON_LINKAGE TraceFileHandler
49 {
50 private:
51
52 /* File path to write messages
53 */
54 char* _fileName;
55
56 /* Handle to the File
57 */
58 FILE* _fileHandle;
59
60 /* Flag to track writing of message to log
61 */
62 Boolean _wroteToLog;
63
64 mike 1.2 public:
65
66 /** Writes message to file.
67 Implementation of this function is platform specific
68 @param message message to be written
69 @param fmt printf style format string
70 @param argList variable argument list
71 */
72 void handleMessage(const char* message,const char* fmt,va_list argList);
73
74 /** Sets the filename to the given filename and opens the file in append
75 mode
76 @param fileName full path of the file
77 @return 0 if the function is successful in opening the file
78 1 if an error occurs while opening the file
79 */
80 Uint32 setFileName(const char* fileName);
81
82 /** Validates the File Path for the trace File
83 @param filePath full path of the file
84 @return 1 if the file path is valid
85 mike 1.2 0 if the file path is invalid
86 */
87 Boolean isValidFilePath(const char* filePath);
88
89 TraceFileHandler();
90
91 ~TraceFileHandler();
|
92 kumpf 1.7
|
93 mike 1.2 };
94
95 PEGASUS_NAMESPACE_END
96
97 #endif /* Pegasus_TraceFileHandler_h */
|