LogManager: Move android logcat code into the proper place.

This commit is contained in:
Scott Mansell 2015-10-04 02:10:43 +13:00
parent 5f8a67250f
commit f84577b90b
3 changed files with 50 additions and 7 deletions

View File

@ -32,9 +32,16 @@ set(SRCS BreakPoints.cpp
x64Emitter.cpp
Crypto/bn.cpp
Crypto/ec.cpp
Logging/ConsoleListenerNix.cpp
Logging/LogManager.cpp)
if(ANDROID)
set(SRCS ${SRCS}
Logging/ConsoleListenerDroid.cpp)
else()
set(SRCS ${SRCS}
Logging/ConsoleListenerNix.cpp)
endif()
set(LIBS enet)
if(_M_ARM_64)
set(SRCS ${SRCS}

View File

@ -0,0 +1,42 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <android/log.h>
#include "Common/Logging/ConsoleListener.h"
ConsoleListener::ConsoleListener()
{
}
ConsoleListener::~ConsoleListener()
{
}
void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char *text)
{
android_LogPriority logLevel = ANDROID_LOG_UNKNOWN;
// Map dolphin's log levels to android's
switch(level)
{
case LogTypes::LOG_LEVELS::LDEBUG:
logLevel = ANDROID_LOG_DEBUG;
break;
case LogTypes::LOG_LEVELS::LINFO:
logLevel = ANDROID_LOG_INFO;
break;
case LogTypes::LOG_LEVELS::LWARNING:
logLevel = ANDROID_LOG_WARN;
break;
case LogTypes::LOG_LEVELS::LERROR:
logLevel = ANDROID_LOG_ERROR;
break;
case LogTypes::LOG_LEVELS::LNOTICE:
logLevel = ANDROID_LOG_INFO;
break;
}
__android_log_write(logLevel, "Dolphinemu", text);
}

View File

@ -9,9 +9,6 @@
#include <set>
#include <string>
#ifdef ANDROID
#include <android/log.h>
#endif
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/StringUtil.h"
@ -133,9 +130,6 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
file, line,
LogTypes::LOG_LEVEL_TO_CHAR[(int)level],
log->GetShortName().c_str(), temp);
#ifdef ANDROID
__android_log_write(ANDROID_LOG_INFO, "Dolphinemu", msg.c_str());
#endif
for (auto listener_id : *log)
m_listeners[listener_id]->Log(level, msg.c_str());