mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Adding line and file name to the log.
This makes the log line a bit too long in my taste so if anyone got an idea of how to make it look nicer i.e making it optional or adding it only to errors/warnings do share git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4776 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ded7a2921d
commit
ad594abe69
@ -105,14 +105,15 @@ enum LOG_LEVELS {
|
||||
#define INFO_LOG(...) {}
|
||||
#define DEBUG_LOG(...) {}
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *fmt, ...);
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char *fmt, ...);
|
||||
|
||||
#ifdef GEKKO
|
||||
#define GENERIC_LOG(t, v, ...)
|
||||
#else
|
||||
|
||||
// Let the compiler optimize this out
|
||||
#define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {GenericLog(v, t, __VA_ARGS__);}}
|
||||
#define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__);}}
|
||||
#endif
|
||||
|
||||
#if MAX_LOGLEVEL >= ERROR_LEVEL
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
#include "LogManager.h"
|
||||
#include "Timer.h"
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* fmt, ...)
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
LogManager::GetInstance()->Log(level, type, fmt, args);
|
||||
LogManager::GetInstance()->Log(level, type, file, line, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@ -95,7 +95,8 @@ LogManager::~LogManager() {
|
||||
}
|
||||
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *format, va_list args) {
|
||||
const char *file, int line, const char *format,
|
||||
va_list args) {
|
||||
|
||||
char temp[MAX_MSGLEN];
|
||||
char msg[MAX_MSGLEN + 512];
|
||||
@ -107,11 +108,10 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
|
||||
|
||||
static const char level_to_char[7] = "-NEWID";
|
||||
sprintf(msg, "%s %c[%s]: %s\n",
|
||||
sprintf(msg, "%s %s:%u %c[%s]: %s\n",
|
||||
Common::Timer::GetTimeFormatted().c_str(),
|
||||
level_to_char[(int)level],
|
||||
log->getShortName(),
|
||||
temp);
|
||||
file, line, level_to_char[(int)level],
|
||||
log->getShortName(), temp);
|
||||
|
||||
logMutex.Enter();
|
||||
log->trigger(level, msg);
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
|
||||
|
||||
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *fmt, va_list args);
|
||||
const char *file, int line, const char *fmt, va_list args);
|
||||
|
||||
void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) {
|
||||
m_Log[type]->setLevel(level);
|
||||
|
Loading…
Reference in New Issue
Block a user