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