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

 1 karl  1.5 //%2003////////////////////////////////////////////////////////////////////////
 2 mike  1.2 //
 3 karl  1.5 // 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.3 // 
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           #include <iostream>
33           #include <Pegasus/Common/Logger.h>
34           #include <Pegasus/Common/TraceFileHandler.h>
35           
36 mike  1.2 PEGASUS_USING_STD;
37           
38           PEGASUS_NAMESPACE_BEGIN
39           
40           ////////////////////////////////////////////////////////////////////////////////
41           //   Writes message to file. 
42           //   Implementation of this function is platform specific
43           // 
44           //   Note: The current implementation writes the message to the defined file.
45           //         Will have to be enhanced to support synchronous write operations to
46           //         the same file.
47           ////////////////////////////////////////////////////////////////////////////////
48           void TraceFileHandler::handleMessage(
49               const char* message,
50               const char* fmt,
51               va_list argList) 
52           {
53               Uint32 retCode;
54           
55               if (_fileHandle)
56               {
57 mike  1.2         //Move to the End of File
58                   fseek(_fileHandle,0,SEEK_SET);
59           
60                   // Write message to file
61                   fprintf(_fileHandle,"%s", message);
62                   vfprintf(_fileHandle,fmt,argList);
63                   retCode = fprintf(_fileHandle,"\n");
64           
65                   if (retCode < 0)
66                   {
67           	    // Unable to write message to file
68           	    // Log message 
69 humberto 1.4 	    //l10n
70              	    //Logger::put(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
71              	        //"Unable to write trace message to File $0",_fileName);
72              	      Logger::put_l(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
73              	      	"Common.TraceFileHandlerWindows.UNABLE_TO_WRITE_TRACE_TO_FILE",
74 mike     1.2 	        "Unable to write trace message to File $0",_fileName);
75                      }
76              	else
77              	{
78                          fflush(_fileHandle);
79                      }
80                  }
81                  else
82                  {
83              	// Invalid file handle
84              	// Log message 
85 humberto 1.4 	//l10n
86              	//Logger::put(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
87                          //"Invalid file handle for file $0",_fileName);
88                    Logger::put_l(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
89                    		"Common.TraceFileHandlerWindows.INVALID_FILE_HANDLE",
90 mike     1.2             "Invalid file handle for file $0",_fileName);
91                  }
92              } 
93              
94              PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2