95 lines
2.3 KiB
C++
95 lines
2.3 KiB
C++
#ifndef __Log_h__
|
|
#define __Log_h__
|
|
|
|
#include "includes"
|
|
#include "File.h"
|
|
#include "Object.h"
|
|
|
|
namespace core {
|
|
|
|
class ConsoleServer;
|
|
|
|
static const int LOG_NONE = 0;
|
|
static const int LOG_INFO = 1;
|
|
static const int LOG_WARN = 2;
|
|
static const int LOG_EXCEPT = 4;
|
|
static const int LOG_DEBUG_1 = 8;
|
|
static const int LOG_DEBUG_2 = 16;
|
|
static const int LOG_DEBUG_3 = 32;
|
|
static const int LOG_DEBUG_4 = 64;
|
|
|
|
///
|
|
/// Log
|
|
///
|
|
/// Provides easy to access and use logging features to maintain a
|
|
/// history of activity and provide information for activity debugging.
|
|
///
|
|
|
|
class Log : public std::ostringstream, public Object {
|
|
|
|
public:
|
|
|
|
///
|
|
/// Constructor method that accepts a pointer to the applications
|
|
/// console server. This enables the Log object to send new log
|
|
/// messages to the connected console sessions.
|
|
///
|
|
/// @param consoleServer a pointer to the console server that will
|
|
/// be used to echo log entries.
|
|
///
|
|
|
|
Log(ConsoleServer *consoleServer);
|
|
|
|
///
|
|
/// Constructor method accepts a file object that will be used to
|
|
/// echo all log entries. This provides a permanent disk file record
|
|
/// of all logged activity.
|
|
///
|
|
|
|
Log(File *logFile);
|
|
|
|
///
|
|
/// Constructor method that is used to send a message to the log.
|
|
///
|
|
/// @param level the logging level to associate with this message.
|
|
///
|
|
/// To send log message: Log(LOG_INFO) << "This is a log message.";
|
|
///
|
|
|
|
Log(int level);
|
|
|
|
///
|
|
/// The destructor for the log object.
|
|
///
|
|
|
|
~Log();
|
|
|
|
bool output = false;
|
|
|
|
///
|
|
/// Set the consoleServer to point to the instantiated ConsoleServer
|
|
/// object for the application.
|
|
///
|
|
|
|
static ConsoleServer *consoleServer;
|
|
|
|
///
|
|
/// Specify a File object where the log entries will be written as
|
|
/// a permanent record to disk.
|
|
///
|
|
|
|
static File *logFile;
|
|
|
|
///
|
|
/// A meaningless sequenctial number that starts from - at the
|
|
/// beginning of the logging process.
|
|
///
|
|
|
|
static int seq;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|