Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging: Use AndroidLogger for all mobile devices #10493

Merged
merged 1 commit into from Jan 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions UI/NativeApp.cpp
Expand Up @@ -191,10 +191,7 @@ int Win32Mix(short *buffer, int numSamples, int bits, int rate, int channels) {
#endif

// globals
#ifndef _WIN32
static AndroidLogger *logger = 0;
#endif

static AndroidLogger *logger = nullptr;
std::string boot_filename = "";

void NativeHost::InitSound() {
Expand Down Expand Up @@ -372,8 +369,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
LogManager::Init();

#ifndef _WIN32
logger = new AndroidLogger();

g_Config.AddSearchPath(user_data_path);
g_Config.AddSearchPath(g_Config.memStickDirectory + "PSP/SYSTEM/");
g_Config.SetDefaultPath(g_Config.memStickDirectory + "PSP/SYSTEM/");
Expand Down Expand Up @@ -499,9 +494,13 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
logman->SetEnabled(type, true);
logman->SetLogLevel(type, logLevel);
}
#ifdef __ANDROID__
logman->AddListener(logger);
#endif

#if defined(__ANDROID__) || (defined(MOBILE_DEVICE) && !defined(_DEBUG))
// Enable basic logging for any kind of mobile device, since LogManager doesn't.
// The MOBILE_DEVICE/_DEBUG condition matches LogManager.cpp.
logger = new AndroidLogger();
logman->AddListener(logger);
#endif

// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
Expand Down Expand Up @@ -1139,6 +1138,9 @@ void NativeShutdown() {

net::Shutdown();

delete logger;
logger = nullptr;

// Previously we did exit() here on Android but that makes it hard to do things like restart on backend change.
// I think we handle most globals correctly or correct-enough now.
}
Expand Down