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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2