integrated latest changes from main repository

This commit is contained in:
Guenter Obiltschnig 2007-05-01 09:35:46 +00:00
parent a18bc8939f
commit 0fc23174be
5 changed files with 108 additions and 11 deletions

View File

@ -1,7 +1,7 @@
// //
// LogStream.h // LogStream.h
// //
// $Id: //poco/Main/Foundation/include/Poco/LogStream.h#2 $ // $Id: //poco/Main/Foundation/include/Poco/LogStream.h#3 $
// //
// Library: Foundation // Library: Foundation
// Package: Logging // Package: Logging
@ -9,7 +9,7 @@
// //
// Definition of the LogStream class. // Definition of the LogStream class.
// //
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
@ -71,6 +71,9 @@ public:
Message::Priority getPriority() const; Message::Priority getPriority() const;
/// Returns the priority for log messages. /// Returns the priority for log messages.
Logger& logger() const;
/// Returns a reference to the Logger.
private: private:
int writeToDevice(char c); int writeToDevice(char c);
@ -125,27 +128,59 @@ public:
LogStream& fatal(); LogStream& fatal();
/// Sets the priority for log messages to Message::PRIO_FATAL. /// Sets the priority for log messages to Message::PRIO_FATAL.
LogStream& fatal(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_FATAL
/// and writes the given message.
LogStream& critical(); LogStream& critical();
/// Sets the priority for log messages to Message::PRIO_CRITICAL. /// Sets the priority for log messages to Message::PRIO_CRITICAL.
LogStream& critical(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_CRITICAL
/// and writes the given message.
LogStream& error(); LogStream& error();
/// Sets the priority for log messages to Message::PRIO_ERROR. /// Sets the priority for log messages to Message::PRIO_ERROR.
LogStream& error(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_ERROR
/// and writes the given message.
LogStream& warning(); LogStream& warning();
/// Sets the priority for log messages to Message::PRIO_WARNING. /// Sets the priority for log messages to Message::PRIO_WARNING.
LogStream& warning(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_WARNING
/// and writes the given message.
LogStream& notice(); LogStream& notice();
/// Sets the priority for log messages to Message::PRIO_NOTICE. /// Sets the priority for log messages to Message::PRIO_NOTICE.
LogStream& notice(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_NOTICE
/// and writes the given message.
LogStream& information(); LogStream& information();
/// Sets the priority for log messages to Message::PRIO_INFORMATION. /// Sets the priority for log messages to Message::PRIO_INFORMATION.
LogStream& information(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_INFORMATION
/// and writes the given message.
LogStream& debug(); LogStream& debug();
/// Sets the priority for log messages to Message::PRIO_DEBUG. /// Sets the priority for log messages to Message::PRIO_DEBUG.
LogStream& debug(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_DEBUG
/// and writes the given message.
LogStream& trace(); LogStream& trace();
/// Sets the priority for log messages to Message::PRIO_TRACE. /// Sets the priority for log messages to Message::PRIO_TRACE.
LogStream& trace(const std::string& message);
/// Sets the priority for log messages to Message::PRIO_TRACE
/// and writes the given message.
LogStream& priority(Message::Priority priority); LogStream& priority(Message::Priority priority);
/// Sets the priority for log messages. /// Sets the priority for log messages.
}; };
@ -160,6 +195,12 @@ inline Message::Priority LogStreamBuf::getPriority() const
} }
inline Logger& LogStreamBuf::logger() const
{
return _logger;
}
} // namespace Poco } // namespace Poco

View File

@ -1,13 +1,13 @@
// //
// LogStream.cpp // LogStream.cpp
// //
// $Id: //poco/Main/Foundation/src/LogStream.cpp#3 $ // $Id: //poco/Main/Foundation/src/LogStream.cpp#4 $
// //
// Library: Foundation // Library: Foundation
// Package: Logging // Package: Logging
// Module: LogStream // Module: LogStream
// //
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
@ -128,6 +128,13 @@ LogStream& LogStream::fatal()
return priority(Message::PRIO_FATAL); return priority(Message::PRIO_FATAL);
} }
LogStream& LogStream::fatal(const std::string& message)
{
_buf.logger().fatal(message);
return priority(Message::PRIO_FATAL);
}
LogStream& LogStream::critical() LogStream& LogStream::critical()
{ {
@ -135,42 +142,91 @@ LogStream& LogStream::critical()
} }
LogStream& LogStream::critical(const std::string& message)
{
_buf.logger().critical(message);
return priority(Message::PRIO_CRITICAL);
}
LogStream& LogStream::error() LogStream& LogStream::error()
{ {
return priority(Message::PRIO_ERROR); return priority(Message::PRIO_ERROR);
} }
LogStream& LogStream::error(const std::string& message)
{
_buf.logger().error(message);
return priority(Message::PRIO_ERROR);
}
LogStream& LogStream::warning() LogStream& LogStream::warning()
{ {
return priority(Message::PRIO_WARNING); return priority(Message::PRIO_WARNING);
} }
LogStream& LogStream::warning(const std::string& message)
{
_buf.logger().warning(message);
return priority(Message::PRIO_WARNING);
}
LogStream& LogStream::notice() LogStream& LogStream::notice()
{ {
return priority(Message::PRIO_NOTICE); return priority(Message::PRIO_NOTICE);
} }
LogStream& LogStream::notice(const std::string& message)
{
_buf.logger().notice(message);
return priority(Message::PRIO_NOTICE);
}
LogStream& LogStream::information() LogStream& LogStream::information()
{ {
return priority(Message::PRIO_INFORMATION); return priority(Message::PRIO_INFORMATION);
} }
LogStream& LogStream::information(const std::string& message)
{
_buf.logger().information(message);
return priority(Message::PRIO_INFORMATION);
}
LogStream& LogStream::debug() LogStream& LogStream::debug()
{ {
return priority(Message::PRIO_DEBUG); return priority(Message::PRIO_DEBUG);
} }
LogStream& LogStream::debug(const std::string& message)
{
_buf.logger().debug(message);
return priority(Message::PRIO_DEBUG);
}
LogStream& LogStream::trace() LogStream& LogStream::trace()
{ {
return priority(Message::PRIO_TRACE); return priority(Message::PRIO_TRACE);
} }
LogStream& LogStream::trace(const std::string& message)
{
_buf.logger().trace(message);
return priority(Message::PRIO_TRACE);
}
LogStream& LogStream::priority(Message::Priority priority) LogStream& LogStream::priority(Message::Priority priority)
{ {
_buf.setPriority(priority); _buf.setPriority(priority);

View File

@ -1,7 +1,7 @@
// //
// HTTPServerRequest.h // HTTPServerRequest.h
// //
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerRequest.h#5 $ // $Id: //poco/Main/Net/include/Poco/Net/HTTPServerRequest.h#6 $
// //
// Library: Net // Library: Net
// Package: HTTPServer // Package: HTTPServer
@ -56,7 +56,7 @@ class HTTPServerParams;
class Net_API HTTPServerRequest: public HTTPRequest class Net_API HTTPServerRequest: public HTTPRequest
/// This abstract HTTPServerRequest of HTTPRequest is used for /// This abstract subclass of HTTPRequest is used for
/// representing server-side HTTP requests. /// representing server-side HTTP requests.
/// ///
/// A HTTPServerRequest is passed to the /// A HTTPServerRequest is passed to the

View File

@ -1,7 +1,7 @@
// //
// ICMPv4PacketImpl.h // ICMPv4PacketImpl.h
// //
// $Id: //poco/Main/Net/include/Poco/Net/ICMPv4PacketImpl.h#2 $ // $Id: //poco/Main/Net/include/Poco/Net/ICMPv4PacketImpl.h#3 $
// //
// Library: Net // Library: Net
// Package: ICMP // Package: ICMP
@ -77,12 +77,12 @@ public:
REDIRECT, REDIRECT,
ICMP_6, ICMP_6,
ICMP_7, ICMP_7,
ECHO, ECHO_REQUEST,
ICMP_9, ICMP_9,
ICMP_10, ICMP_10,
TIME_EXCEEDED, TIME_EXCEEDED,
PARAMETER_PROBLEM, PARAMETER_PROBLEM,
TIMESTAMP, TIMESTAMP_REQUEST,
TIMESTAMP_REPLY, TIMESTAMP_REPLY,
INFORMATION_REQUEST, INFORMATION_REQUEST,
INFORMATION_REPLY, INFORMATION_REPLY,

View File

@ -1,7 +1,7 @@
// //
// ICMPv4PacketImpl.cpp // ICMPv4PacketImpl.cpp
// //
// $Id: //poco/Main/Net/src/ICMPv4PacketImpl.cpp#4 $ // $Id: //poco/Main/Net/src/ICMPv4PacketImpl.cpp#5 $
// //
// Library: Net // Library: Net
// Package: ICMP // Package: ICMP
@ -147,7 +147,7 @@ void ICMPv4PacketImpl::initPacket()
if (_seq >= MAX_SEQ_VALUE) resetSequence(); if (_seq >= MAX_SEQ_VALUE) resetSequence();
Header* icp = (Header*) packet(false); Header* icp = (Header*) packet(false);
icp->type = ECHO; icp->type = ECHO_REQUEST;
icp->code = 0; icp->code = 0;
icp->checksum = 0; icp->checksum = 0;
icp->seq = ++_seq; icp->seq = ++_seq;