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

 1 karl  1.7 //%2005////////////////////////////////////////////////////////////////////////
 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 karl  1.5 // IBM Corp.; EMC Corporation, The Open Group.
 7 karl  1.6 // 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.7 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 mike  1.2 //
12           // Permission is hereby granted, free of charge, to any person obtaining a copy
13           // of this software and associated documentation files (the "Software"), to
14           // deal in the Software without restriction, including without limitation the
15           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16           // sell copies of the Software, and to permit persons to whom the Software is
17           // furnished to do so, subject to the following conditions:
18 kumpf 1.3 // 
19 mike  1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27           //
28           //==============================================================================
29           //
30           // Author: Sushma Fernandes, Hewlett-Packard Company (sushma_fernandes@hp.com)
31           //
32           // Modified By:
33           //
34           //%/////////////////////////////////////////////////////////////////////////////
35           
36           #include <iostream>
37           #include <Pegasus/Common/Logger.h>
38           #include <Pegasus/Common/TraceFileHandler.h>
39           
40 mike  1.2 PEGASUS_USING_STD;
41           
42           PEGASUS_NAMESPACE_BEGIN
43           
44           ////////////////////////////////////////////////////////////////////////////////
45           //   Writes message to file. 
46           //   Implementation of this function is platform specific
47           // 
48           //   Note: The current implementation writes the message to the defined file.
49           //         Will have to be enhanced to support synchronous write operations to
50           //         the same file.
51           ////////////////////////////////////////////////////////////////////////////////
52           void TraceFileHandler::handleMessage(
53               const char* message,
54               const char* fmt,
55               va_list argList) 
56           {
57               Uint32 retCode;
58           
59               if (_fileHandle)
60               {
61 mike  1.2         //Move to the End of File
62                   fseek(_fileHandle,0,SEEK_SET);
63           
64                   // Write message to file
65                   fprintf(_fileHandle,"%s", message);
66                   vfprintf(_fileHandle,fmt,argList);
67                   retCode = fprintf(_fileHandle,"\n");
68           
69                   if (retCode < 0)
70                   {
71           	    // Unable to write message to file
72           	    // Log message 
73 humberto 1.4 	    //l10n
74              	    //Logger::put(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
75              	        //"Unable to write trace message to File $0",_fileName);
76              	      Logger::put_l(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
77              	      	"Common.TraceFileHandlerWindows.UNABLE_TO_WRITE_TRACE_TO_FILE",
78 mike     1.2 	        "Unable to write trace message to File $0",_fileName);
79                      }
80              	else
81              	{
82                          fflush(_fileHandle);
83                      }
84                  }
85                  else
86                  {
87              	// Invalid file handle
88              	// Log message 
89 humberto 1.4 	//l10n
90              	//Logger::put(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
91                          //"Invalid file handle for file $0",_fileName);
92                    Logger::put_l(Logger::DEBUG_LOG,"Tracer",Logger::WARNING,
93                    		"Common.TraceFileHandlerWindows.INVALID_FILE_HANDLE",
94 mike     1.2             "Invalid file handle for file $0",_fileName);
95                  }
96              } 
97              
98              PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2