version 1.58, 2008/05/07 19:41:42
|
version 1.62, 2008/08/12 18:26:27
|
|
|
#include <fstream> | #include <fstream> |
#include <cstring> | #include <cstring> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
|
#include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
#include <Pegasus/Common/FileSystem.h> | #include <Pegasus/Common/FileSystem.h> |
#include <Pegasus/Common/MessageLoader.h> | #include <Pegasus/Common/MessageLoader.h> |
|
|
"PegasusTrace.log", | "PegasusTrace.log", |
"PegasusStandard.log", | "PegasusStandard.log", |
"PegasusAudit.log", | "PegasusAudit.log", |
"PegasusError.log", |
"PegasusError.log" |
"PegasusDebug.log" |
|
}; | }; |
static const char* lockFileName = "PegasusLog.lock"; | static const char* lockFileName = "PegasusLog.lock"; |
| |
|
|
const Uint32 logComponent, // FUTURE: Support logComponent mask | const Uint32 logComponent, // FUTURE: Support logComponent mask |
Uint32 logLevel, | Uint32 logLevel, |
const String& formatString, | const String& formatString, |
const String& messageId, |
const char* messageId, |
const Formatter::Arg& arg0, | const Formatter::Arg& arg0, |
const Formatter::Arg& arg1, | const Formatter::Arg& arg1, |
const Formatter::Arg& arg2, | const Formatter::Arg& arg2, |
|
|
| |
// If the caller specified a messageId, then load the localized | // If the caller specified a messageId, then load the localized |
// message in the locale of the server process. | // message in the locale of the server process. |
if (messageId != String::EMPTY) |
if (messageId) |
{ | { |
// A message ID was specified. Use the MessageLoader. | // A message ID was specified. Use the MessageLoader. |
MessageLoaderParms msgParms(messageId, formatString); | MessageLoaderParms msgParms(messageId, formatString); |
|
|
} | } |
// l10n end | // l10n end |
| |
|
|
// Call the actual logging routine is in LoggerRep. | // Call the actual logging routine is in LoggerRep. |
_rep->log(logFileType, systemId, logLevel, localizedMsg); | _rep->log(logFileType, systemId, logLevel, localizedMsg); |
|
|
|
// route log message to trace too -> component LogMessages |
|
if (Logger::TRACE_LOG != logFileType) |
|
{ |
|
// do not write log message to trace when trace facility is |
|
// the log to avoid double messages |
|
if (Tracer::TRACE_FACILITY_LOG != Tracer::getTraceFacility()) |
|
{ |
|
PEG_TRACE_CSTRING( |
|
TRC_LOGMSG, |
|
Tracer::LEVEL1, |
|
(const char*) localizedMsg.getCString()); |
|
} |
|
} |
} | } |
} | } |
| |
|
|
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
Logger::_putInternal(logFileType, systemId, 0, logLevel, | Logger::_putInternal(logFileType, systemId, 0, logLevel, |
formatString, String::EMPTY, arg0, arg1, arg2, arg3, |
formatString, 0, arg0, arg1, arg2, arg3, |
arg4, arg5, arg6, arg7, arg8, arg9); | arg4, arg5, arg6, arg7, arg8, arg9); |
} | } |
} | } |
|
|
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
Logger::_putInternal(logFileType, systemId, 0, logLevel, | Logger::_putInternal(logFileType, systemId, 0, logLevel, |
formatString, String::EMPTY); |
formatString, 0); |
} | } |
} | } |
| |
|
|
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
Logger::_putInternal(logFileType, systemId, 0, logLevel, | Logger::_putInternal(logFileType, systemId, 0, logLevel, |
formatString, String::EMPTY, arg0); |
formatString, 0, arg0); |
} | } |
} | } |
| |
|
|
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
Logger::_putInternal(logFileType, systemId, 0, logLevel, | Logger::_putInternal(logFileType, systemId, 0, logLevel, |
formatString, String::EMPTY, arg0, arg1); |
formatString, 0, arg0, arg1); |
} | } |
} | } |
| |
|
|
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
Logger::_putInternal(logFileType, systemId, 0, logLevel, | Logger::_putInternal(logFileType, systemId, 0, logLevel, |
formatString, String::EMPTY, arg0, arg1, arg2); |
formatString, 0, arg0, arg1, arg2); |
} | } |
} | } |
| |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, |
const char* messageId, |
const String& formatString, |
const char* formatString, |
const Formatter::Arg& arg0, | const Formatter::Arg& arg0, |
const Formatter::Arg& arg1, | const Formatter::Arg& arg1, |
const Formatter::Arg& arg2, | const Formatter::Arg& arg2, |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, |
const char* messageId, |
const String& formatString) |
const char* formatString) |
{ | { |
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
{ | { |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, |
const char* messageId, |
const String& formatString, |
const char* formatString, |
const Formatter::Arg& arg0) | const Formatter::Arg& arg0) |
{ | { |
if (wouldLog(logLevel)) | if (wouldLog(logLevel)) |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, |
const char* messageId, |
const String& formatString, |
const char* formatString, |
const Formatter::Arg& arg0, | const Formatter::Arg& arg0, |
const Formatter::Arg& arg1) | const Formatter::Arg& arg1) |
{ | { |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, |
const char* messageId, |
const String& formatString, |
const char* formatString, |
const Formatter::Arg& arg0, | const Formatter::Arg& arg0, |
const Formatter::Arg& arg1, | const Formatter::Arg& arg1, |
const Formatter::Arg& arg2) | const Formatter::Arg& arg2) |
|
|
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
const Uint32 logComponent, | const Uint32 logComponent, |
const String& formatString, |
const String& message) |
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1, |
|
const Formatter::Arg& arg2, |
|
const Formatter::Arg& arg3, |
|
const Formatter::Arg& arg4, |
|
const Formatter::Arg& arg5, |
|
const Formatter::Arg& arg6, |
|
const Formatter::Arg& arg7, |
|
const Formatter::Arg& arg8, |
|
const Formatter::Arg& arg9) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, String::EMPTY, arg0, arg1, arg2, arg3, arg4, arg5, |
|
arg6, arg7, arg8, arg9); |
|
} |
|
} |
|
|
|
void Logger::trace( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& formatString) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, String::EMPTY); |
|
} |
|
} |
|
|
|
void Logger::trace( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& formatString, |
|
const Formatter::Arg& arg0) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, String::EMPTY, arg0); |
|
} |
|
} |
|
|
|
void Logger::trace( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, String::EMPTY, arg0, arg1); |
|
} |
|
} |
|
|
|
void Logger::trace( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1, |
|
const Formatter::Arg& arg2) |
|
{ | { |
if (wouldLog(Logger::TRACE)) | if (wouldLog(Logger::TRACE)) |
{ | { |
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, | Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
formatString, String::EMPTY, arg0, arg1, arg2); |
message, 0); |
} |
|
} |
|
|
|
void Logger::trace_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1, |
|
const Formatter::Arg& arg2, |
|
const Formatter::Arg& arg3, |
|
const Formatter::Arg& arg4, |
|
const Formatter::Arg& arg5, |
|
const Formatter::Arg& arg6, |
|
const Formatter::Arg& arg7, |
|
const Formatter::Arg& arg8, |
|
const Formatter::Arg& arg9) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5, arg6, |
|
arg7, arg8, arg9); |
|
} |
|
} |
|
|
|
void Logger::trace_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& messageId, |
|
const String& formatString) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId); |
|
} |
|
} |
|
|
|
void Logger::trace_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId, arg0); |
|
} |
|
} |
|
|
|
void Logger::trace_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId, arg0, arg1); |
|
} |
|
} |
|
|
|
void Logger::trace_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
const Uint32 logComponent, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1, |
|
const Formatter::Arg& arg2) |
|
{ |
|
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId, arg0, arg1, arg2); |
|
} | } |
} | } |
| |