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

  1 martin 1.6 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.7 //
  3 martin 1.6 // Licensed to The Open Group (TOG) under one or more contributor license
  4            // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5            // this work for additional information regarding copyright ownership.
  6            // Each contributor licenses this file to you under the OpenPegasus Open
  7            // Source License; you may not use this file except in compliance with the
  8            // License.
  9 martin 1.7 //
 10 martin 1.6 // Permission is hereby granted, free of charge, to any person obtaining a
 11            // copy of this software and associated documentation files (the "Software"),
 12            // to deal in the Software without restriction, including without limitation
 13            // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14            // and/or sell copies of the Software, and to permit persons to whom the
 15            // Software is furnished to do so, subject to the following conditions:
 16 martin 1.7 //
 17 martin 1.6 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.7 //
 20 martin 1.6 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.7 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.6 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23            // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24            // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25            // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26            // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.7 //
 28 martin 1.6 //////////////////////////////////////////////////////////////////////////
 29 r.kieninger 1.1 //
 30                 //%/////////////////////////////////////////////////////////////////////////////
 31                 
 32 r.kieninger 1.5 #if defined(PEGASUS_OS_ZOS)
 33 marek       1.2 #define _ISOC99_SOURCE
 34                 #include <stdio.h>
 35                 #include <stdarg.h>
 36                 #endif
 37                 
 38 r.kieninger 1.5 #include <Pegasus/Common/Config.h>
 39 r.kieninger 1.1 #include <Pegasus/Common/FileSystem.h>
 40                 #include <Pegasus/Common/TraceLogHandler.h>
 41                 
 42                 PEGASUS_USING_STD;
 43                 
 44                 PEGASUS_NAMESPACE_BEGIN
 45                 
 46                 ////////////////////////////////////////////////////////////////////////////////
 47                 //  Constructs TraceLogHandler
 48                 ////////////////////////////////////////////////////////////////////////////////
 49                 TraceLogHandler::TraceLogHandler()
 50                 {
 51                 }
 52                 
 53                 ////////////////////////////////////////////////////////////////////////////////
 54                 //  Destructs TraceLogHandler
 55                 ////////////////////////////////////////////////////////////////////////////////
 56                 TraceLogHandler::~TraceLogHandler()
 57                 {
 58                 }
 59                 
 60 r.kieninger 1.1 ////////////////////////////////////////////////////////////////////////////////
 61                 //  Sends a trace message with format string to the Logger
 62                 ////////////////////////////////////////////////////////////////////////////////
 63                 void TraceLogHandler::handleMessage(
 64                     const char *message,
 65 thilo.boehm 1.4     Uint32 msgLen,
 66 r.kieninger 1.1     const char *fmt, va_list argList)
 67                 {
 68                     if (Logger::wouldLog(Logger::TRACE))
 69                     {
 70                         char buffer[4096];
 71 kumpf       1.8 
 72 marek       1.3 #ifdef PEGASUS_OS_TYPE_WINDOWS
 73                         // Windows until VC 8 does not support vsnprintf
 74                         // need to use Windows equivalent function with the underscore
 75                         _vsnprintf(buffer, 4095, fmt, argList);
 76                 #else
 77 r.kieninger 1.1         vsnprintf(buffer, 4095, fmt, argList);
 78 kumpf       1.8 #endif
 79 r.kieninger 1.1         String completeMsg(buffer);
 80 thilo.boehm 1.4         completeMsg.append(message, msgLen);
 81 kumpf       1.8 
 82                         Logger::trace( Logger::TRACE_LOG,
 83                                        System::CIMSERVER,
 84 r.kieninger 1.1                        Logger::TRACE,
 85                                        completeMsg );
 86 kumpf       1.8     }
 87 r.kieninger 1.1 }
 88                 
 89                 ////////////////////////////////////////////////////////////////////////////////
 90                 //  Sends a simple trace message to the Logger
 91                 ////////////////////////////////////////////////////////////////////////////////
 92 thilo.boehm 1.4 void TraceLogHandler::handleMessage(const char *message, Uint32 msgLen)
 93 r.kieninger 1.1 {
 94                     if (Logger::wouldLog(Logger::TRACE))
 95                     {
 96                         Logger::trace( Logger::TRACE_LOG, System::CIMSERVER, Logger::TRACE,
 97                                        String(message) );
 98 kumpf       1.8     }
 99 r.kieninger 1.1 }
100                 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2