2010-02-09 05:18:39 +01:00
|
|
|
// Copyright (c) 2008-2010 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones
|
|
|
|
// This file is part of the "cAudio Engine"
|
|
|
|
// For conditions of distribution and use, see copyright notice in cAudio.h
|
|
|
|
|
2009-11-20 04:39:56 +01:00
|
|
|
#ifndef ILOGGER_H_INCLUDED
|
|
|
|
#define ILOGGER_H_INCLUDED
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2009-11-20 04:39:56 +01:00
|
|
|
#include "ILogReceiver.h"
|
|
|
|
#include "cAudioDefines.h"
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2009-11-20 04:39:56 +01:00
|
|
|
namespace cAudio
|
|
|
|
{
|
2010-02-17 06:57:55 +01:00
|
|
|
//! Interface for all logging operations in cAudio.
|
2009-11-20 04:39:56 +01:00
|
|
|
class ILogger
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ILogger() { }
|
|
|
|
virtual ~ILogger() { }
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2010-02-17 06:57:55 +01:00
|
|
|
//! Used to log a critical error message to the logging system.
|
|
|
|
/**
|
|
|
|
\param sender: Name of the class/component sending the message.
|
|
|
|
\param msg: The message to send. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void logCritical( const char* sender, const char *msg, ... ) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Used to log an error message to the logging system.
|
|
|
|
/**
|
|
|
|
\param sender: Name of the class/component sending the message.
|
|
|
|
\param msg: The message to send. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void logError( const char* sender, const char *msg, ... ) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Used to log a warning to the logging system.
|
|
|
|
/**
|
|
|
|
\param sender: Name of the class/component sending the message.
|
|
|
|
\param msg: The message to send. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void logWarning( const char* sender, const char *msg, ... ) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Used to log an informational message to the logging system.
|
|
|
|
/**
|
|
|
|
\param sender: Name of the class/component sending the message.
|
|
|
|
\param msg: The message to send. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void logInfo( const char* sender, const char *msg, ... ) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Used to log a debug message to the logging system.
|
|
|
|
/**
|
|
|
|
\param sender: Name of the class/component sending the message.
|
|
|
|
\param msg: The message to send. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void logDebug( const char* sender, const char *msg, ... ) = 0;
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2010-02-17 06:57:55 +01:00
|
|
|
//! Returns the minimum log level that will be sent to the log receivers.
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual const LogLevel& getLogLevel() const = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Sets the minimum log level that the engine will send to log receivers.
|
|
|
|
/** Primarily used to prevent too much verbose information from being sent to disk/console.
|
|
|
|
\param logLevel: LogLevel to set as the new minimum. Anything equal to or greater than this level will be logged. */
|
2009-11-20 04:39:56 +01:00
|
|
|
virtual void setLogLevel( const LogLevel& logLevel ) = 0;
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2010-02-17 06:57:55 +01:00
|
|
|
//! Register Log Receiver.
|
|
|
|
/** Note: Any class registered will become owned by the internal thread.
|
|
|
|
If threading is enabled, you MUST make the receiver threadsafe if you plan to access it in your application while it is registered.
|
|
|
|
\param receiver: Pointer to your implementation of ILogReceiver.
|
|
|
|
\param name: Name of the log receiver.
|
|
|
|
\return True on success, False on failure. */
|
2009-12-01 02:41:15 +01:00
|
|
|
virtual bool registerLogReceiver(ILogReceiver* receiver, const char* name) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Unregister a Log Receiver.
|
|
|
|
/** Will NOT delete any user added receiver, you must do that yourself.
|
|
|
|
\param name: Name of the log receiver to remove. */
|
2009-12-01 02:41:15 +01:00
|
|
|
virtual void unRegisterLogReceiver(const char* name) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Returns whether an log receiver is currently registered.
|
|
|
|
/**
|
|
|
|
\param name: Name of the log receiver to check for. */
|
2009-12-01 02:41:15 +01:00
|
|
|
virtual bool isLogReceiverRegistered(const char* name) = 0;
|
2010-02-17 06:57:55 +01:00
|
|
|
|
|
|
|
//! Returns a registered log receiver.
|
|
|
|
/**
|
|
|
|
\param name: Name of the log receiver to return.
|
|
|
|
\return Pointer to the found log receiver or NULL if it could not be found. */
|
2009-12-01 02:41:15 +01:00
|
|
|
virtual ILogReceiver* getLogReceiver(const char* name) = 0;
|
2010-02-14 18:08:16 +01:00
|
|
|
|
2009-11-20 04:39:56 +01:00
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
};
|
2009-09-12 07:59:28 +02:00
|
|
|
|
2010-02-17 06:57:55 +01:00
|
|
|
//! Gets the interface to the logger.
|
2009-11-20 04:39:56 +01:00
|
|
|
/** Note: This is the only way to get access to the logging capabilities of cAudio.
|
2010-02-17 06:57:55 +01:00
|
|
|
\return A pointer to the logger interface.
|
2009-11-20 04:39:56 +01:00
|
|
|
*/
|
|
|
|
CAUDIO_API ILogger* getLogger();
|
|
|
|
};
|
|
|
|
#endif //! ILOGGER_H_INCLUDED
|