Author: tabish
Date: Wed Feb 10 20:26:34 2010
New Revision: 908659
URL: http://svn.apache.org/viewvc?rev=908659&view=rev
Log:
Refine the API a bit and implement some more of the functionality. Update the
documentation as well.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.cpp?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.cpp
Wed Feb 10 20:26:34 2010
@@ -38,6 +38,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+const Level Level::INHERIT( "INHERIT", 0 );
const Level Level::OFF( "OFF", Integer::MAX_VALUE );
const Level Level::SEVERE( "SEVERE", 1000 );
const Level Level::WARNING( "WARNING", 900 );
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.h?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.h
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Level.h
Wed Feb 10 20:26:34 2010
@@ -39,6 +39,7 @@
* * SEVERE (highest value)
* * WARNING
* * INFO
+ * * DEBUG
* * CONFIG
* * FINE
* * FINER
@@ -61,6 +62,12 @@
public:
/**
+ * NULL is a special level that indicates that the Logger should get
its Level from
+ * its parent Logger, the value is initialized as zero.
+ */
+ static const Level INHERIT;
+
+ /**
* OFF is a special level that can be used to turn off logging. This
level is initialized
* to Integer::MAX_VALUE
*/
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.cpp?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.cpp
Wed Feb 10 20:26:34 2010
@@ -89,6 +89,13 @@
}
////////////////////////////////////////////////////////////////////////////////
+bool LogManager::addLogger( Logger* logger DECAF_UNUSED )
+ throw( decaf::lang::exceptions::NullPointerException,
+ decaf::lang::exceptions::IllegalArgumentException ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
Logger* LogManager::getLogger( const std::string& name DECAF_UNUSED ) {
return NULL;
}
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.h?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.h
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogManager.h
Wed Feb 10 20:26:34 2010
@@ -27,6 +27,9 @@
#include <decaf/util/concurrent/Mutex.h>
#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+
namespace decaf{
namespace lang{
class Runtime;
@@ -154,6 +157,22 @@
virtual ~LogManager();
/**
+ * Add a named logger. This does nothing and returns false if a logger
with
+ * the same name is already registered.
+ *
+ * The Logger factory methods call this method to register each newly
created Logger.
+ *
+ * @param logger
+ * The new Logger instance to add to this LogManager.
+ *
+ * @throws NullPointerException if logger is NULL.
+ * @throws IllegalArgumentException if the logger has no name.
+ */
+ bool addLogger( Logger* logger )
+ throw( decaf::lang::exceptions::NullPointerException,
+ decaf::lang::exceptions::IllegalArgumentException );
+
+ /**
* Sets the Properties this LogManager should use to configure
* its loggers. Once set a properties change event is fired.
* @param properties Pointer to read the configuration from
@@ -236,7 +255,7 @@
LogManager();
/**
- * Copy Constructo
+ * Copy Constructor
* @param manager the Manager to copy
*/
LogManager( const LogManager& manager );
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.cpp?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.cpp
Wed Feb 10 20:26:34 2010
@@ -24,29 +24,33 @@
using namespace decaf;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
+using namespace decaf::util;
using namespace decaf::util::logging;
////////////////////////////////////////////////////////////////////////////////
-Logger::Logger( const std::string& name DECAF_UNUSED,
- Logger* parent DECAF_UNUSED ) {
+Logger::Logger( const std::string& name ) : level( Level::INHERIT ) {
+
+ this->name = name;
}
////////////////////////////////////////////////////////////////////////////////
Logger::~Logger() {
+
+ std::list<Handler*>::iterator handler = this->handlers.begin();
+ for( ; handler != this->handlers.end(); ++handler ) {
+ delete *handler;
+ }
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::addHandler( Handler* handler ) throw ( IllegalArgumentException )
{
+void Logger::addHandler( Handler* handler ) throw ( NullPointerException ) {
- if( handler == NULL )
- {
- IllegalArgumentException(
- __FILE__, __LINE__,
- "Logger::addHandler - HAndler cannot be null");
+ if( handler == NULL ) {
+ NullPointerException(
+ __FILE__, __LINE__, "Logger::addHandler - Handler cannot be null");
}
- if( find( handlers.begin(), handlers.end(), handler) != handlers.end() )
- {
+ if( find( handlers.begin(), handlers.end(), handler) != handlers.end() ) {
handlers.push_back( handler );
}
}
@@ -54,42 +58,57 @@
////////////////////////////////////////////////////////////////////////////////
void Logger::removeHandler( Handler* handler ) {
+ if( handler == NULL ) {
+ return;
+ }
+
list<Handler*>::iterator itr =
find( handlers.begin(), handlers.end(), handler );
if( itr != handlers.end() ) {
-
- delete *itr;
- handlers.erase(itr);
+ handlers.erase( itr );
}
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::setFilter( Filter* filter DECAF_UNUSED ){
+const std::list<Handler*>& Logger::getHandlers() const {
+ return this->handlers;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::setFilter( Filter* filter ){
+ this->filter = filter;
}
////////////////////////////////////////////////////////////////////////////////
-bool Logger::isLoggable( Levels level DECAF_UNUSED ) const{
+bool Logger::isLoggable( const Level& level DECAF_UNUSED ) const{
return false;
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::entry( const std::string& blockName DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED ) {
+void Logger::entering( const std::string& blockName DECAF_UNUSED,
+ const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::exit(const std::string& blockName DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED) {
+void Logger::exiting( const std::string& blockName DECAF_UNUSED,
+ const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::debug( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
+void Logger::severe( const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED,
+ const std::string fnctionName DECAF_UNUSED,
+ const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::warning( const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED,
+ const std::string fnctionName DECAF_UNUSED,
+ const std::string& message DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
@@ -100,33 +119,54 @@
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::error( const std::string& file DECAF_UNUSED,
+void Logger::debug( const std::string& file DECAF_UNUSED,
const int line DECAF_UNUSED,
const std::string fnctionName DECAF_UNUSED,
const std::string& message DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::warn( const std::string& file DECAF_UNUSED,
+void Logger::config( const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED,
+ const std::string fnctionName DECAF_UNUSED,
+ const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::fine( const std::string& file DECAF_UNUSED,
const int line DECAF_UNUSED,
const std::string fnctionName DECAF_UNUSED,
const std::string& message DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::fatal( const std::string& file DECAF_UNUSED,
+void Logger::finer( const std::string& file DECAF_UNUSED,
const int line DECAF_UNUSED,
const std::string fnctionName DECAF_UNUSED,
const std::string& message DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Levels level DECAF_UNUSED,
+void Logger::finest( const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED,
+ const std::string fnctionName DECAF_UNUSED,
+ const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::throwing( const std::string& file DECAF_UNUSED,
+ const int line DECAF_UNUSED,
+ const std::string functionName DECAF_UNUSED,
+ const decaf::lang::Throwable& thrown DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::log( const Level& level DECAF_UNUSED,
const std::string& message DECAF_UNUSED ) {
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Levels level DECAF_UNUSED,
+void Logger::log( const Level& level DECAF_UNUSED,
const std::string& file DECAF_UNUSED,
const int line DECAF_UNUSED,
const std::string& message DECAF_UNUSED,
@@ -134,7 +174,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Levels level DECAF_UNUSED,
+void Logger::log( const Level& level DECAF_UNUSED,
const std::string& file DECAF_UNUSED,
const int line DECAF_UNUSED,
const std::string& message DECAF_UNUSED, ... ) {
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h?rev=908659&r1=908658&r2=908659&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
Wed Feb 10 20:26:34 2010
@@ -19,9 +19,14 @@
#include <decaf/util/logging/LoggerCommon.h>
#include <decaf/util/logging/LogRecord.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/logging/LogManager.h>
+#include <decaf/util/logging/Handler.h>
+#include <decaf/util/concurrent/Mutex.h>
#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+
#include <list>
#include <string>
#include <stdarg.h>
@@ -30,9 +35,54 @@
namespace util{
namespace logging{
- class Handler;
class Filter;
+ /**
+ * A Logger object is used to log messages for a specific system or
application component.
+ * Loggers are normally named, using a hierarchical dot-separated
namespace. Logger names
+ * can be arbitrary strings, but they should normally be based on the
namespace or class
+ * name of the logged component, such as decaf.net or org.apache.decaf. In
addition it is
+ * possible to create "anonymous" Loggers that are not stored in the
Logger namespace.
+ *
+ * Logger objects may be obtained by calls on one of the getLogger factory
methods. These
+ * will either create a new Logger or return a suitable existing Logger.
+ *
+ * Logging messages will be forwarded to registered Handler objects, which
can forward
+ * the messages to a variety of destinations, including consoles, files,
OS logs, etc.
+ *
+ * Each Logger keeps track of a "parent" Logger, which is its nearest
existing ancestor
+ * in the Logger namespace.
+ *
+ * Each Logger has a "Level" associated with it. This reflects a minimum
Level that this
+ * logger cares about. If a Logger's level is set to Level::INHERIT, then
its effective level
+ * is inherited from its parent, which may in turn obtain it recursively
from its parent,
+ * and so on up the tree.
+ *
+ * The log level can be configured based on the properties from the
logging configuration
+ * file, as described in the description of the LogManager class. However
it may also be
+ * dynamically changed by calls on the Logger.setLevel method. If a
logger's level is changed
+ * the change may also affect child loggers, since any child logger that
has 'inherit' as its
+ * level will inherit its effective level from its parent.
+ *
+ * On each logging call the Logger initially performs a cheap check of the
request level
+ * (e.g. SEVERE or FINE) against the effective log level of the logger. If
the request level
+ * is lower than the log level, the logging call returns immediately.
+ *
+ * After passing this initial (cheap) test, the Logger will allocate a
LogRecord to describe
+ * the logging message. It will then call a Filter (if present) to do a
more detailed check
+ * on whether the record should be published. If that passes it will then
publish the LogRecord
+ * to its output Handlers. By default, loggers also publish to their
parent's Handlers,
+ * recursively up the tree.
+ *
+ * Formatting is the responsibility of the output Handler, which will
typically call a Formatter.
+ *
+ * Note that formatting need not occur synchronously. It may be delayed
until a LogRecord is
+ * actually written to an external sink.
+ *
+ * All methods on Logger are thread safe.
+ *
+ * @since 1.0
+ */
class DECAF_API Logger {
private:
@@ -49,26 +99,28 @@
Filter* filter;
// The Log Level of this Logger
- Levels level;
+ Level level;
// Using Parent Handlers?
bool useParentHandlers;
- public:
+ protected:
/**
- * Creates a new instance of the Logger with the given name
- * and assign it the given parent logger.
- * <p>
+ * Creates a new instance of the Logger with the given name.
+ *
* The logger will be initially configured with a null Level
* and with useParentHandlers true.
- * @param name - A name for the logger. This should be a
- * dot-separated name and should normally be based on the package
- * name or class name of the subsystem, such as java.net or
- * javax.swing. It may be null for anonymous Loggers.
- * @param parent logger that is this one's parent
+ *
+ * @param name
+ * A name for the logger. This should be a dot-separated name and
+ * should normally be based on the package name or class name of
the
+ * subsystem, such as decaf.net or org.apache.decaf. It may be
empty
+ * for anonymous Loggers.
*/
- Logger( const std::string& name, Logger* parent );
+ Logger( const std::string& name );
+
+ public:
virtual ~Logger();
@@ -76,79 +128,114 @@
* Gets the name of this Logger
* @return logger name
*/
- virtual const std::string& getName() const {
+ const std::string& getName() const {
return name;
}
/**
+ * Gets the parent of this Logger which will be the nearest existing
Logger in this
+ * Loggers namespace.
+ *
+ * If this is the Root Logger than this method returns NULL.
+ *
+ * @return Pointer to this Loggers nearest parent Logger.
+ */
+ Logger* getParent() const {
+ return this->parent;
+ }
+
+ /**
+ * Set the parent for this Logger. This method is used by the
LogManager to update
+ * a Logger when the namespace changes.
+ *
+ * It should not be called from application code.
+ */
+ void setParent( Logger* parent ) {
+ this->parent = parent;
+ }
+
+ /**
* Add a log Handler to receive logging messages.
- * <p>
+ *
* By default, Loggers also send their output to their parent logger.
* Typically the root Logger is configured with a set of Handlers
* that essentially act as default handlers for all loggers.
*
+ * The ownership of the given Handler is passed to the Logger and the
+ * Handler will be deleted when this Logger is destroyed unless the
caller
+ * first calls removeHandler with the same pointer value as was
originally
+ * given.
+ *
* @param handler A Logging Handler
- * @throws IllegalArgumentException
+ *
+ * @throws NullPointerException if the Handler given is NULL.
*/
- virtual void addHandler( Handler* handler )
- throw ( lang::exceptions::IllegalArgumentException );
+ void addHandler( Handler* handler )
+ throw ( lang::exceptions::NullPointerException );
/**
- * Removes the specified Handler and destroys it
- * <p>
+ * Removes the specified Handler from this logger, ownership of the
+ * Handler pointer is returned to the caller.
+ *
* Returns silently if the given Handler is not found.
+ *
* @param handler The Handler to remove
*/
- virtual void removeHandler( Handler* handler );
+ void removeHandler( Handler* handler );
/**
* Gets a vector containing all the handlers that this class
* has been assigned to use.
* @returns a list of handlers that are used by this logger
*/
- // virtual const std::list<Handler*>& getHandlers() const;
+ const std::list<Handler*>& getHandlers() const;
/**
* Set a filter to control output on this Logger.
- * <p>
+ *
* After passing the initial "level" check, the Logger will call
* this Filter to check if a log record should really be published.
- * <p>
+ *
* The caller releases ownership of this filter to this logger
- * @param filter to use, can be null
+ *
+ * @param filter
+ * The Filter to use, (can be NULL).
*/
- virtual void setFilter( Filter* filter );
+ void setFilter( Filter* filter );
/**
* Gets the Filter object that this class is using.
- * @return the Filter in use, can be null
+ * @return the Filter in use, (can be NULL).
*/
- virtual const Filter* getFilter() const {
+ const Filter* getFilter() const {
return filter;
}
/**
* Get the log Level that has been specified for this Logger. The
- * result may be the Null level, which means that this logger's
+ * result may be the INHERIT level, which means that this logger's
* effective level will be inherited from its parent.
+ *
* @return the level that is currently set
*/
- virtual Levels getLevel() const {
+ Level getLevel() const {
return level;
}
/**
* Set the log level specifying which message levels will be logged
* by this logger. Message levels lower than this value will be
- * discarded. The level value Level.OFF can be used to turn off
+ * discarded. The level value Level::OFF can be used to turn off
* logging.
- * <p>
- * If the new level is the Null Level, it means that this node
+ *
+ * If the new level is the INHERIT Level, it means that this node
* should inherit its level from its nearest ancestor with a
- * specific (non-null) level value.
- * @param level new Level value
+ * specific (non-INHERIT) level value.
+ *
+ * @param level
+ * The new Level value to use when logging.
*/
- virtual void setLevel( Levels level ) {
+ void setLevel( const Level& level ) {
this->level = level;
}
@@ -157,76 +244,113 @@
* its parent logger.
* @return true if using Parent Handlers
*/
- virtual bool getUseParentHandlers() const {
+ bool getUseParentHandlers() const {
return useParentHandlers;
}
/**
- * pecify whether or not this logger should send its output to it's
+ * Specify whether or not this logger should send its output to it's
* parent Logger. This means that any LogRecords will also be
* written to the parent's Handlers, and potentially to its parent,
* recursively up the namespace.
- * @param value True is output is to be writen to the parent
+ *
+ * @param value
+ * True is output is to be written to the parent
*/
- virtual void setUseParentHandlers( bool value ) {
+ void setUseParentHandlers( bool value ) {
this->useParentHandlers = value;
}
+ public: // Logging Methods.
+
/**
* Logs an Block Enter message
- * <p>
- * This is a convenience method that is used to tag a block enter, a
- * log record with the class name function name and the string
- * Entering is logged at the DEBUG log level.
- * @param blockName source block name
- * @param file source file name
- * @param line source line name
- */
- virtual void entry( const std::string& blockName,
- const std::string& file,
- const int line );
+ *
+ * This is a convenience method that is used to tag a block enter, a
log record
+ * with the given information is logged at the Level::FINER log level.
+ *
+ * @param blockName
+ * The source block name, (usually ClassName::MethodName, or
MethodName).
+ * @param file
+ * The source file name where this method was called from.
+ * @param line
+ * The source line number where this method was called from.
+ */
+ virtual void entering( const std::string& blockName,
+ const std::string& file,
+ const int line );
/**
* Logs an Block Exit message
- * <p>
- * This is a convenience method that is used to tag a block exit, a
- * log record with the class name function name and the string
- * Exiting is logged at the DEBUG log level.
- * @param blockName source block name
- * @param file source file name
- * @param line source line name
- */
- virtual void exit( const std::string& blockName,
- const std::string& file,
- const int line );
+ *
+ * This is a convenience method that is used to tag a block enter, a
log record
+ * with the given information is logged at the Level::FINER log level.
+ *
+ * @param blockName
+ * The source block name, (usually ClassName::MethodName, or
MethodName).
+ * @param file
+ * The source file name where this method was called from.
+ * @param line
+ * The source line number where this method was called from.
+ */
+ virtual void exiting( const std::string& blockName,
+ const std::string& file,
+ const int line );
/**
- * Log a Debug Level Log
- * <p>
- * If the logger is currently enabled for the DEBUG message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
- */
- virtual void debug( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
+ * Log a SEVERE Level Log
+ *
+ * If the logger is currently enabled for the SEVERE message level
then the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
+ */
+ virtual void severe( const std::string& file,
+ const int line,
+ const std::string functionName,
+ const std::string& message );
/**
- * Log a info Level Log
- * <p>
- * If the logger is currently enabled for the info message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
+ * Log a WARN Level Log
*
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
+ * If the logger is currently enabled for the WARN message level then
the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
+ */
+ virtual void warning( const std::string& file,
+ const int line,
+ const std::string functionName,
+ const std::string& message );
+
+ /**
+ * Log a INFO Level Log
+ *
+ * If the logger is currently enabled for the INFO message level then
the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
*/
virtual void info( const std::string& file,
const int line,
@@ -234,68 +358,128 @@
const std::string& message );
/**
- * Log a warn Level Log
- * <p>
- * If the logger is currently enabled for the warn message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
+ * Log a DEBUG Level Log
+ *
+ * If the logger is currently enabled for the DEBUG message level then
the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
+ */
+ virtual void debug( const std::string& file,
+ const int line,
+ const std::string functionName,
+ const std::string& message );
+
+ /**
+ * Log a CONFIG Level Log
+ *
+ * If the logger is currently enabled for the CONFIG message level
then the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
+ */
+ virtual void config( const std::string& file,
+ const int line,
+ const std::string functionName,
+ const std::string& message );
+
+ /**
+ * Log a FINE Level Log
+ *
+ * If the logger is currently enabled for the FINE message level then
the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
*/
- virtual void warn( const std::string& file,
+ virtual void fine( const std::string& file,
const int line,
const std::string functionName,
const std::string& message );
/**
- * Log a error Level Log
- * <p>
- * If the logger is currently enabled for the error message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param fnctionName name of the function that logged this
- * @param message the message to log
+ * Log a FINER Level Log
+ *
+ * If the logger is currently enabled for the FINER message level then
the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
*/
- virtual void error( const std::string& file,
+ virtual void finer( const std::string& file,
const int line,
- const std::string fnctionName,
+ const std::string functionName,
const std::string& message );
/**
- * Log a fatal Level Log
- * <p>
- * If the logger is currently enabled for the fatal message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
- */
- virtual void fatal( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
+ * Log a FINEST Level Log
+ *
+ * If the logger is currently enabled for the FINEST message level
then the
+ * given message is forwarded to all the registered output Handler
objects.
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param message
+ * The message to log at this Level.
+ */
+ virtual void finest( const std::string& file,
+ const int line,
+ const std::string functionName,
+ const std::string& message );
/**
- * Log a Throw Message
- * <p>
- * If the logger is currently enabled for the Throwing message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
+ * Log throwing an exception.
+ *
+ * This is a convenience method to log that a method is terminating by
throwing an
+ * exception. The logging is done using the FINER level.
+ *
+ * If the logger is currently enabled for the given message level then
the given
+ * arguments are stored in a LogRecord which is forwarded to all
registered output
+ * handlers. The LogRecord's message is set to "THROW".
+ *
+ * @param file
+ * The file name where the log was generated.
+ * @param line
+ * The line number where the log was generated.
+ * @param functionName
+ * The name of the function that logged this.
+ * @param thrown
+ * The Throwable that will be thrown, will be cloned.
+ */
virtual void throwing( const std::string& file,
const int line,
const std::string functionName,
- const std::string& message );
- */
+ const decaf::lang::Throwable& thrown );
/**
* Check if a message of the given level would actually be logged
@@ -304,7 +488,7 @@
* @param level - a message logging level
* @returns true if the given message level is currently being logged.
*/
- virtual bool isLoggable( Levels level ) const;
+ virtual bool isLoggable( const Level& level ) const;
/**
* Log a LogRecord.
@@ -324,7 +508,7 @@
* @param level the Level to log at
* @param message the message to log
*/
- virtual void log( Levels level, const std::string& message );
+ virtual void log( const Level& level, const std::string& message );
/**
* Log a message, with the list of params that is formatted into
@@ -338,7 +522,7 @@
* @param line the line in the file
* @param ... variable length argument to format the message string.
*/
- virtual void log( Levels levels,
+ virtual void log( const Level& levels,
const std::string& file,
const int line,
const std::string& message, ... );
@@ -358,7 +542,7 @@
* @param message the message to log.
* @param ex the Exception to log
*/
- virtual void log( Levels level,
+ virtual void log( const Level& level,
const std::string& file,
const int line,
const std::string& message,