version 1.28.6.3, 2003/08/14 11:55:42
|
version 1.41, 2005/10/03 17:29:12
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// sushma_fernandes@hp.com | // sushma_fernandes@hp.com |
// Modified By: Dave Rosckes (IBM) | // Modified By: Dave Rosckes (IBM) |
// rosckes@us.ibm.com | // rosckes@us.ibm.com |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP101 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <cstring> | #include <cstring> |
#include "Logger.h" | #include "Logger.h" |
#include "System.h" | #include "System.h" |
#include "Destroyer.h" |
|
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
{ | { |
int index = int(logFileType); | int index = int(logFileType); |
| |
if (index > int(Logger::ERROR_LOG)) |
if (index > int(Logger::NUM_LOGS)) |
index = Logger::ERROR_LOG; | index = Logger::ERROR_LOG; |
| |
return _logs[index]; | return _logs[index]; |
|
|
| |
#if defined(PEGASUS_USE_SYSLOGS) | #if defined(PEGASUS_USE_SYSLOGS) |
| |
// Open the syslog. |
|
// Ignore the systemId and open the log as cimserver |
|
System::openlog(systemId); |
|
|
|
// Log the message | // Log the message |
System::syslog(logLevel,(const char*)localizedMsg.getCStringUTF8()); |
System::syslog(System::CIMSERVER, logLevel, localizedMsg.getCString()); |
|
|
// Close the syslog. |
|
System::closelog(); |
|
| |
#else | #else |
| |
|
|
if (logLevel & Logger::WARNING) tmp = "WARNING "; | if (logLevel & Logger::WARNING) tmp = "WARNING "; |
if (logLevel & Logger::SEVERE) tmp = "SEVERE "; | if (logLevel & Logger::SEVERE) tmp = "SEVERE "; |
if (logLevel & Logger::FATAL) tmp = "FATAL "; | if (logLevel & Logger::FATAL) tmp = "FATAL "; |
|
|
_rep->logOf(logFileType) << System::getCurrentASCIITime() | _rep->logOf(logFileType) << System::getCurrentASCIITime() |
<< " " << tmp << messageString.getCStringUTF8() << endl; |
<< " " << tmp << (const char *)messageString.getCString() << endl; |
| |
#endif | #endif |
} | } |
} | } |
| |
|
#if 1 |
void Logger::put( | void Logger::put( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
|
|
{ | { |
Uint32 logComponent = 0; | Uint32 logComponent = 0; |
| |
Logger::_putInternal( |
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
logFileType, |
formatString, String::EMPTY, arg0, arg1, arg2, arg3, arg4, arg5, arg6, |
systemId, |
arg7, arg8, arg9); |
logComponent, |
} |
logLevel, |
#endif |
formatString, |
|
//l10n |
void Logger::put( |
String::EMPTY, |
LogFileType logFileType, |
arg0, |
const String& systemId, |
arg1, |
Uint32 logLevel, |
arg2, |
const String& formatString) |
arg3, |
{ |
arg4, |
Uint32 logComponent = 0; |
arg5, |
|
arg6, |
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
arg7, |
formatString, String::EMPTY); |
arg8, |
} |
arg9); |
|
|
void Logger::put( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
Uint32 logLevel, |
|
const String& formatString, |
|
const Formatter::Arg& arg0) |
|
{ |
|
Uint32 logComponent = 0; |
|
|
|
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
|
formatString, String::EMPTY, arg0); |
} | } |
| |
// l10n | // l10n |
|
#if 1 |
void Logger::put_l( | void Logger::put_l( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
|
|
{ | { |
Uint32 logComponent = 0; | Uint32 logComponent = 0; |
| |
Logger::_putInternal( |
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
logFileType, |
formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5, |
systemId, |
arg6, arg7, arg8, arg9); |
logComponent, |
} |
logLevel, |
#endif |
formatString, |
|
messageId, |
void Logger::put_l( |
arg0, |
LogFileType logFileType, |
arg1, |
const String& systemId, |
arg2, |
Uint32 logLevel, |
arg3, |
const String& messageId, |
arg4, |
const String& formatString) |
arg5, |
{ |
arg6, |
Uint32 logComponent = 0; |
arg7, |
|
arg8, |
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
arg9); |
formatString, messageId); |
|
} |
|
|
|
void Logger::put_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
Uint32 logLevel, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0) |
|
{ |
|
Uint32 logComponent = 0; |
|
|
|
Logger::_putInternal(logFileType, systemId, logComponent, logLevel, |
|
formatString, messageId, arg0); |
} | } |
| |
void Logger::trace( | void Logger::trace( |
|
|
void Logger::setlogLevelMask( const String logLevelList ) | void Logger::setlogLevelMask( const String logLevelList ) |
{ | { |
Uint32 position = 0; | Uint32 position = 0; |
Uint32 logLevelType; |
Uint32 logLevelType = 0; |
String logLevelName = logLevelList; | String logLevelName = logLevelList; |
| |
// Check if logLevel has been specified | // Check if logLevel has been specified |
|
|
| |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|