Public Types | |
enum | { LOG_CLIENT = 1 << 0, LOG_SERVER = 1 << 1, LOG_APP = 1 << 2, LOG_KERNEL = 1 << 3, LOG_ENGINE = 1 << 4, LOG_CONSOLE = 1 << 5, LOG_PLUGIN = 1 << 6, LOG_ANYTHING = 0xFFFFFFFF } |
Enumeration containing all available log targets. More... | |
enum | _LogLevel { LL_FATAL_ERROR = 0, LL_ERROR, LL_WARNING, LL_NORMAL, LL_DEBUG, LL_CHATTY } |
typedef uint32 | LogTarget |
Log target is an unsigned integer number. | |
typedef enum nrEngine::Log::_LogLevel | LogLevel |
Public Member Functions | |
Result | initialize (const std::string &logPath) |
void | log (LogTarget target, const char *msg,...) |
void | log (LogTarget target, LogLevel level, const char *msg,...) |
void | setEcho (LogTarget from, LogTarget to) |
void | setLevel (LogLevel logLevel) |
Friends | |
class | Engine |
Only engine's core class is allowed to create the instance. |
Log Class is using to generate and print logging information on console, MessageBox(WIN32) or in a log file on the disk. You can generate log messages either by giving the message directly or by using message ID-Number of needed. This guarantee to be log messages not hardcoded and they can also be localized (language). All used log messages should be stored in an extra file to allow logging by Msg-Id-Number.
Definition at line 41 of file Log.h.
typedef enum nrEngine::Log::_LogLevel nrEngine::Log::LogLevel |
Each log message has a certain log level. Each log message that should be logged has such kind of information about the log level.
You can specify which kind of level information should be logged. All messsages with the type above the specified type will be logged. i.e. setting upo the log engine to log messages with LL_WARNING will log fatal errors, errors and warnings.
anonymous enum |
Enumeration containing all available log targets.
LOG_CLIENT | Log the messages to the client log file. Here you should log all messages coming from client. |
LOG_SERVER | Log here messages coming from server if you using networking. |
LOG_APP | Use this target to log all application logs coming from your game. |
LOG_KERNEL | This target will be used by kernel to log it's own messages. |
LOG_ENGINE | The engine will use this target to log it own messages. Note: Kernel has got it's own target. |
LOG_CONSOLE | This will log to standard console output. |
LOG_PLUGIN | Messages coming from plugins should be logged here. |
LOG_ANYTHING | Log to all targets above. |
Each log message has a certain log level. Each log message that should be logged has such kind of information about the log level.
You can specify which kind of level information should be logged. All messsages with the type above the specified type will be logged. i.e. setting upo the log engine to log messages with LL_WARNING will log fatal errors, errors and warnings.
Result nrEngine::Log::initialize | ( | const std::string & | logPath | ) |
Initialize logging subsystem
logPath | - Path to directory where log files will be created |
Definition at line 41 of file Log.cpp.
References LL_DEBUG, log(), LOG_ANYTHING, and nrEngine::OK.
Referenced by nrEngine::Engine::initializeLog().
void nrEngine::Log::log | ( | LogTarget | target, | |
const char * | msg, | |||
... | ||||
) |
Log any message to the given log target. You can bitwise combine log targets (i.e. LOG_CONSOLE | LOG_APP) to log to one or more log targets. Each message logged through this method will get a normal log level.
target | Target where the log message should be written | |
msg | Formatted message to log |
Definition at line 59 of file Log.cpp.
References LL_NORMAL.
Referenced by initialize(), nrEngine::Engine::runEngine(), and nrEngine::Engine::stopEngine().
void nrEngine::Log::setLevel | ( | LogLevel | logLevel | ) |