(file) Return to TraceFileHandler.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.12 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.2  //
  3 karl  1.9  // 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 karl  1.6  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.9  // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.11 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.12 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.2  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 kumpf 1.4  // 
 21 mike  1.2  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            
 35            #ifndef Pegasus_TraceFileHandler_h
 36            #define Pegasus_TraceFileHandler_h
 37            
 38            #include <cstdarg>
 39            #include <cstdio>
 40            #include <Pegasus/Common/String.h>
 41 kumpf 1.5  #include <Pegasus/Common/Linkage.h>
 42 mike  1.2  
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45 kumpf 1.13 /** TraceFileHandler implements logging of messages to file
 46 mike  1.2   */
 47            
 48 kumpf 1.13 class PEGASUS_COMMON_LINKAGE TraceFileHandler
 49 mike  1.2  {
 50            private:
 51            
 52 kumpf 1.10     /** Open the specified file in append mode and ensure the file owner and
 53                    permissions are appropriate.
 54                    @param    fileName Full path of the file to open.
 55                    @return   Handle to the opened file if successful, otherwise 0.
 56                 */
 57                FILE* _openFile(const char* fileName);
 58            
 59 mike  1.2      /* File path to write messages
 60                 */
 61                char* _fileName;
 62            
 63 a.arora 1.8  #ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU
 64                  /* Base File path to write messages
 65                   */
 66                  char* _baseFileName;
 67              
 68                  /* Count for the suffix of the trace file
 69                   */
 70                  Uint32 _fileCount;
 71              #endif
 72              
 73 mike    1.2      /* Handle to the File
 74                   */
 75                  FILE* _fileHandle;
 76              
 77 kumpf   1.13     /* Flag to track writing of message to log
 78 mike    1.2       */
 79                  Boolean _wroteToLog;
 80              
 81              public:
 82              
 83                  /** Writes message to file.
 84                      Implementation of this function is platform specific
 85                      @param    message  message to be written
 86                      @param    fmt      printf style format string
 87                      @param    argList  variable argument list
 88                   */
 89                  void handleMessage(const char* message,const char* fmt,va_list argList);
 90              
 91 marek   1.14     /** Writes message to file.
 92                      Implementation of this function is platform specific
 93                      @param    message  message to be written
 94                   */
 95                  void handleMessage(const char* message);
 96              
 97              
 98 mike    1.2      /** Sets the filename to the given filename and opens the file in append
 99                      mode
100 kumpf   1.13         @param    fileName full path of the file
101 mike    1.2          @return   0        if the function is successful in opening the file
102                                1        if an error occurs while opening the file
103                   */
104                  Uint32 setFileName(const char* fileName);
105              
106                  /** Validates the File Path for the trace File
107 kumpf   1.13         @param    filePath full path of the file
108 mike    1.2          @return   1        if the file path is valid
109                                0        if the file path is invalid
110                   */
111                  Boolean isValidFilePath(const char* filePath);
112              
113                  TraceFileHandler();
114              
115                  ~TraceFileHandler();
116 kumpf   1.7  
117 marek   1.14 private:
118              
119                  /** Prepares write of message to file.
120                      Implementation of this function is platform specific
121                   */
122                  void prepareFileHandle(void);
123              
124 mike    1.2  };
125              
126              PEGASUS_NAMESPACE_END
127              
128              #endif /* Pegasus_TraceFileHandler_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2