diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index 209d59919e..275bd051cf 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -6,11 +6,12 @@ package org.dolphinemu.dolphinemu; -import android.util.Log; + import android.view.Surface; import android.widget.Toast; import org.dolphinemu.dolphinemu.activities.EmulationActivity; +import org.dolphinemu.dolphinemu.utils.Log; /** * Class which contains methods that interact @@ -393,7 +394,7 @@ public final class NativeLibrary } catch (UnsatisfiedLinkError ex) { - Log.e("NativeLibrary", ex.toString()); + Log.error("[NativeLibrary] " + ex.toString()); } CacheClassesAndMethods(); @@ -401,7 +402,7 @@ public final class NativeLibrary public static void displayAlertMsg(final String alert) { - Log.e("DolphinEmu", "Alert: " + alert); + Log.error("[NativeLibrary] Alert: " + alert); mEmulationActivity.runOnUiThread(new Runnable() { @Override @@ -414,13 +415,13 @@ public final class NativeLibrary public static void endEmulationActivity() { - Log.v("DolphinEmu", "Ending EmulationActivity."); + Log.verbose("[NativeLibrary]Ending EmulationActivity."); mEmulationActivity.exitWithAnimation(); } public static void setEmulationActivity(EmulationActivity emulationActivity) { - Log.v("DolphinEmu", "Registering EmulationActivity."); + Log.verbose("[NativeLibrary]Registering EmulationActivity."); mEmulationActivity = emulationActivity; } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index e1dceb9219..f03ff54024 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -8,7 +8,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.Menu; @@ -33,6 +32,7 @@ import org.dolphinemu.dolphinemu.fragments.LoadStateFragment; import org.dolphinemu.dolphinemu.fragments.MenuFragment; import org.dolphinemu.dolphinemu.fragments.SaveStateFragment; import org.dolphinemu.dolphinemu.ui.main.MainPresenter; +import org.dolphinemu.dolphinemu.utils.Log; import java.util.List; @@ -211,7 +211,7 @@ public final class EmulationActivity extends AppCompatActivity protected void onStart() { super.onStart(); - Log.d("DolphinEmu", "EmulationActivity starting."); + Log.debug("[EmulationActivity] EmulationActivity starting."); NativeLibrary.setEmulationActivity(this); } @@ -219,7 +219,7 @@ public final class EmulationActivity extends AppCompatActivity protected void onStop() { super.onStop(); - Log.d("DolphinEmu", "EmulationActivity stopping."); + Log.debug("[EmulationActivity] EmulationActivity stopping."); NativeLibrary.setEmulationActivity(null); } @@ -650,14 +650,14 @@ public final class EmulationActivity extends AppCompatActivity } else { - Log.e("DolphinEmu", "[EmulationActivity] Fragment not found, can't remove."); + Log.error("[EmulationActivity] Fragment not found, can't remove."); } mSubmenuFragmentTag = null; } else { - Log.e("DolphinEmu", "[EmulationActivity] Fragment Tag empty."); + Log.error("[EmulationActivity] Fragment Tag empty."); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/SettingsActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/SettingsActivity.java index c6ce27acfe..d97eccb8e7 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/SettingsActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/SettingsActivity.java @@ -5,10 +5,10 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import org.dolphinemu.dolphinemu.fragments.SettingsFragment; import org.dolphinemu.dolphinemu.services.SettingsSaveService; +import org.dolphinemu.dolphinemu.utils.Log; public final class SettingsActivity extends AppCompatActivity { @@ -33,7 +33,7 @@ public final class SettingsActivity extends AppCompatActivity { super.onStop(); - Log.d("DolphinEmulator", "Settings activity stopping. Saving settings to INI..."); + Log.debug("[SettingsActivity] Settings activity stopping. Saving settings to INI..."); // Copy assets into appropriate locations. Intent settingsSaver = new Intent(this, SettingsSaveService.class); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java index fd8784f81c..dafe77bef0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java @@ -6,7 +6,6 @@ import android.database.DataSetObserver; import android.graphics.Bitmap; import android.graphics.Rect; import android.support.v7.widget.RecyclerView; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -17,6 +16,7 @@ import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.activities.EmulationActivity; import org.dolphinemu.dolphinemu.dialogs.GameDetailsDialog; import org.dolphinemu.dolphinemu.model.GameDatabase; +import org.dolphinemu.dolphinemu.utils.Log; import org.dolphinemu.dolphinemu.viewholders.GameViewHolder; /** @@ -106,12 +106,12 @@ public final class GameAdapter extends RecyclerView.Adapter impl } else { - Log.e("DolphinEmu", "Can't bind view; Cursor is not valid."); + Log.error("[GameAdapter] Can't bind view; Cursor is not valid."); } } else { - Log.e("DolphinEmu", "Can't bind view; dataset is not valid."); + Log.error("[GameAdapter] Can't bind view; dataset is not valid."); } } @@ -127,7 +127,7 @@ public final class GameAdapter extends RecyclerView.Adapter impl { return mCursor.getCount(); } - Log.e("DolphinEmu", "Dataset is not valid."); + Log.error("[GameAdapter] Dataset is not valid."); return 0; } @@ -148,7 +148,7 @@ public final class GameAdapter extends RecyclerView.Adapter impl } } - Log.e("DolphinEmu", "Dataset is not valid."); + Log.error("[GameAdapter] Dataset is not valid."); return 0; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java index aea1f39df0..cb74a00208 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java @@ -5,12 +5,12 @@ import android.content.Context; import android.content.SharedPreferences; import android.preference.Preference; import android.preference.PreferenceManager; -import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; import org.dolphinemu.dolphinemu.NativeLibrary; +import org.dolphinemu.dolphinemu.utils.Log; import java.util.ArrayList; import java.util.List; @@ -43,7 +43,7 @@ public final class MotionAlertDialog extends AlertDialog @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - Log.d("InputConfigFragment", "Received key event: " + event.getAction()); + Log.debug("[MotionAlertDialog] Received key event: " + event.getAction()); switch (event.getAction()) { case KeyEvent.ACTION_DOWN: @@ -67,7 +67,7 @@ public final class MotionAlertDialog extends AlertDialog if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) return false; - Log.d("InputConfigFragment", "Received motion event: " + event.getAction()); + Log.debug("[MotionAlertDialog] Received motion event: " + event.getAction()); InputDevice input = event.getDevice(); List motions = input.getMotionRanges(); @@ -160,7 +160,7 @@ public final class MotionAlertDialog extends AlertDialog } else { - Log.e("DolphinEmu", "Failed to save input to INI."); + Log.error("[MotionAlertDialog] Failed to save input to INI."); } @@ -176,7 +176,7 @@ public final class MotionAlertDialog extends AlertDialog } else { - Log.e("DolphinEmu", "Failed to save input to preference."); + Log.error("[MotionAlertDialog] Failed to save input to preference."); } dismiss(); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java index ab79e62a68..58d1ddde30 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java @@ -4,7 +4,6 @@ import android.app.Fragment; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.util.Log; import android.view.LayoutInflater; import android.view.Surface; import android.view.SurfaceHolder; @@ -16,6 +15,7 @@ import org.dolphinemu.dolphinemu.BuildConfig; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.overlay.InputOverlay; +import org.dolphinemu.dolphinemu.utils.Log; public final class EmulationFragment extends Fragment implements SurfaceHolder.Callback @@ -151,13 +151,13 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C @Override public void surfaceCreated(SurfaceHolder holder) { - Log.d("DolphinEmu", "Surface created."); + Log.debug("[EmulationFragment] Surface created."); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.d("DolphinEmu", "Surface changed. Resolution: " + width + "x" + height); + Log.debug("[EmulationFragment] Surface changed. Resolution: " + width + "x" + height); mSurface = holder.getSurface(); NativeLibrary.SurfaceChanged(mSurface); } @@ -165,7 +165,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C @Override public void surfaceDestroyed(SurfaceHolder holder) { - Log.d("DolphinEmu", "Surface destroyed."); + Log.debug("[EmulationFragment] Surface destroyed."); NativeLibrary.SurfaceDestroyed(); if (mEmulationRunning) @@ -178,13 +178,13 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C { if (!mEmulationStarted) { - Log.d("DolphinEmu", "Starting emulation thread."); + Log.debug("[EmulationFragment] Starting emulation thread."); mEmulationThread.start(); } else { - Log.d("DolphinEmu", "Resuming emulation."); + Log.debug("[EmulationFragment] Resuming emulation."); NativeLibrary.UnPauseEmulation(); } @@ -193,7 +193,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C private void pauseEmulation() { - Log.d("DolphinEmu", "Pausing emulation."); + Log.debug("[EmulationFragment] Pausing emulation."); NativeLibrary.PauseEmulation(); mEmulationRunning = false; @@ -221,7 +221,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C if (!mEmulationRunning) return; - Log.i("DolphinEmu", "Starting emulation: " + mSurface); + Log.info("[EmulationFragment] Starting emulation: " + mSurface); // Start emulation using the provided Surface. NativeLibrary.Run(); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameDatabase.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameDatabase.java index ae674c921f..a09fd3d319 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameDatabase.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameDatabase.java @@ -5,9 +5,9 @@ import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import android.util.Log; import org.dolphinemu.dolphinemu.NativeLibrary; +import org.dolphinemu.dolphinemu.utils.Log; import java.io.File; import java.util.Arrays; @@ -88,27 +88,27 @@ public final class GameDatabase extends SQLiteOpenHelper @Override public void onCreate(SQLiteDatabase database) { - Log.d("DolphinEmu", "GameDatabase - Creating database..."); + Log.debug("[GameDatabase] GameDatabase - Creating database..."); - Log.v("DolphinEmu", "Executing SQL: " + SQL_CREATE_GAMES); + Log.verbose("[GameDatabase] Executing SQL: " + SQL_CREATE_GAMES); database.execSQL(SQL_CREATE_GAMES); - Log.v("DolphinEmu", "Executing SQL: " + SQL_CREATE_FOLDERS); + Log.verbose("[GameDatabase] Executing SQL: " + SQL_CREATE_FOLDERS); database.execSQL(SQL_CREATE_FOLDERS); } @Override public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { - Log.i("DolphinEmu", "Upgrading database from schema version " + oldVersion + " to " + newVersion); + Log.info("[GameDatabase] Upgrading database from schema version " + oldVersion + " to " + newVersion); - Log.v("DolphinEmu", "Executing SQL: " + SQL_DELETE_GAMES); + Log.verbose("[GameDatabase] Executing SQL: " + SQL_DELETE_GAMES); database.execSQL(SQL_DELETE_GAMES); - Log.v("DolphinEmu", "Executing SQL: " + SQL_CREATE_GAMES); + Log.verbose("[GameDatabase] Executing SQL: " + SQL_CREATE_GAMES); database.execSQL(SQL_CREATE_GAMES); - Log.v("DolphinEmu", "Re-scanning library with new schema."); + Log.verbose("[GameDatabase] Re-scanning library with new schema."); scanLibrary(database); } @@ -133,7 +133,7 @@ public final class GameDatabase extends SQLiteOpenHelper if (!game.exists()) { - Log.e("DolphinEmu", "Game file no longer exists. Removing from the library: " + gamePath); + Log.error("[GameDatabase] Game file no longer exists. Removing from the library: " + gamePath); database.delete(TABLE_NAME_GAMES, KEY_DB_ID + " = ?", new String[]{Long.toString(fileCursor.getLong(COLUMN_DB_ID))}); @@ -162,7 +162,7 @@ public final class GameDatabase extends SQLiteOpenHelper String folderPath = folderCursor.getString(FOLDER_COLUMN_PATH); File folder = new File(folderPath); - Log.i("DolphinEmu", "Reading files from library folder: " + folderPath); + Log.info("[GameDatabase] Reading files from library folder: " + folderPath); // Iterate through every file in the folder. File[] children = folder.listFiles(); @@ -225,12 +225,12 @@ public final class GameDatabase extends SQLiteOpenHelper // If update fails, insert a new game instead. if (rowsMatched == 0) { - Log.v("DolphinEmu", "Adding game: " + game.getAsString(KEY_GAME_TITLE)); + Log.verbose("[GameDatabase] Adding game: " + game.getAsString(KEY_GAME_TITLE)); database.insert(TABLE_NAME_GAMES, null, game); } else { - Log.v("DolphinEmu", "Updated game: " + game.getAsString(KEY_GAME_TITLE)); + Log.verbose("[GameDatabase] Updated game: " + game.getAsString(KEY_GAME_TITLE)); } } } @@ -240,14 +240,14 @@ public final class GameDatabase extends SQLiteOpenHelper // If the folder is empty because it no longer exists, remove it from the library. else if (!folder.exists()) { - Log.e("DolphinEmu", "Folder no longer exists. Removing from the library: " + folderPath); + Log.error("[GameDatabase] Folder no longer exists. Removing from the library: " + folderPath); database.delete(TABLE_NAME_FOLDERS, KEY_DB_ID + " = ?", new String[]{Long.toString(folderCursor.getLong(COLUMN_DB_ID))}); } else { - Log.e("DolphinEmu", "Folder contains no games: " + folderPath); + Log.error("[GameDatabase] Folder contains no games: " + folderPath); } } @@ -263,7 +263,7 @@ public final class GameDatabase extends SQLiteOpenHelper @Override public void call(Subscriber subscriber) { - Log.i("DolphinEmu", "[GameDatabase] Reading games list..."); + Log.info("[GameDatabase] [GameDatabase] Reading games list..."); String whereClause = null; String[] whereArgs = null; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameProvider.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameProvider.java index dd83851a91..f60e2ca8e6 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameProvider.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameProvider.java @@ -5,9 +5,9 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; -import android.util.Log; import org.dolphinemu.dolphinemu.BuildConfig; +import org.dolphinemu.dolphinemu.utils.Log; /** * Provides an interface allowing Activities to interact with the SQLite database. @@ -31,7 +31,7 @@ public final class GameProvider extends ContentProvider @Override public boolean onCreate() { - Log.i("DolphinEmu", "Creating Content Provider..."); + Log.info("[GameProvider] Creating Content Provider..."); mDbHelper = new GameDatabase(getContext()); @@ -41,7 +41,7 @@ public final class GameProvider extends ContentProvider @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { - Log.i("DolphinEmu", "Querying URI: " + uri); + Log.info("[GameProvider] Querying URI: " + uri); SQLiteDatabase db = mDbHelper.getReadableDatabase(); @@ -49,7 +49,7 @@ public final class GameProvider extends ContentProvider if (table == null) { - Log.e("DolphinEmu", "Badly formatted URI: " + uri); + Log.error("[GameProvider] Badly formatted URI: " + uri); return null; } @@ -62,12 +62,12 @@ public final class GameProvider extends ContentProvider @Override public String getType(Uri uri) { - Log.v("DolphinEmu", "Getting MIME type for URI: " + uri); + Log.verbose("[GameProvider] Getting MIME type for URI: " + uri); String lastSegment = uri.getLastPathSegment(); if (lastSegment == null) { - Log.e("DolphinEmu", "Badly formatted URI: " + uri); + Log.error("[GameProvider] Badly formatted URI: " + uri); return null; } @@ -80,14 +80,14 @@ public final class GameProvider extends ContentProvider return MIME_TYPE_GAME; } - Log.e("DolphinEmu", "Unknown MIME type for URI: " + uri); + Log.error("[GameProvider] Unknown MIME type for URI: " + uri); return null; } @Override public Uri insert(Uri uri, ContentValues values) { - Log.i("DolphinEmu", "Inserting row at URI: " + uri); + Log.info("[GameProvider] Inserting row at URI: " + uri); SQLiteDatabase database = mDbHelper.getWritableDatabase(); String table = uri.getLastPathSegment(); @@ -98,7 +98,7 @@ public final class GameProvider extends ContentProvider { if (table.equals(REFRESH_LIBRARY)) { - Log.i("DolphinEmu", "URI specified table REFRESH_LIBRARY. No insertion necessary; refreshing library contents..."); + Log.info("[GameProvider] URI specified table REFRESH_LIBRARY. No insertion necessary; refreshing library contents..."); mDbHelper.scanLibrary(database); return uri; } @@ -120,12 +120,12 @@ public final class GameProvider extends ContentProvider } else { - Log.e("DolphinEmu", "Row already exists: " + uri + " id: " + id); + Log.error("[GameProvider] Row already exists: " + uri + " id: " + id); } } else { - Log.e("DolphinEmu", "Badly formatted URI: " + uri); + Log.error("[GameProvider] Badly formatted URI: " + uri); } database.close(); @@ -136,14 +136,14 @@ public final class GameProvider extends ContentProvider @Override public int delete(Uri uri, String selection, String[] selectionArgs) { - Log.e("DolphinEmu", "Delete operations unsupported. URI: " + uri); + Log.error("[GameProvider] Delete operations unsupported. URI: " + uri); return 0; } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { - Log.e("DolphinEmu", "Update operations unsupported. URI: " + uri); + Log.error("[GameProvider] Update operations unsupported. URI: " + uri); return 0; } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/AssetCopyService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/AssetCopyService.java index 558a34be37..6004c88c5e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/AssetCopyService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/AssetCopyService.java @@ -10,9 +10,9 @@ import android.app.IntentService; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.util.Log; import org.dolphinemu.dolphinemu.NativeLibrary; +import org.dolphinemu.dolphinemu.utils.Log; import org.dolphinemu.dolphinemu.utils.UserPreferences; import java.io.File; @@ -27,8 +27,6 @@ import java.io.OutputStream; */ public final class AssetCopyService extends IntentService { - private static final String TAG = "DolphinEmulator"; - public AssetCopyService() { // Superclass constructor is called to name the thread on which this service executes. @@ -55,7 +53,7 @@ public final class AssetCopyService extends IntentService } else { - Log.v(TAG, "Skipping asset copy operation."); + Log.verbose("[AssetCopyService] Skipping asset copy operation."); } // Always copy over the GCPad config in case of change or corruption. @@ -77,7 +75,7 @@ public final class AssetCopyService extends IntentService private void copyAsset(String asset, String output) { - Log.v(TAG, "Copying " + asset + " to " + output); + Log.verbose("[AssetCopyService] Copying " + asset + " to " + output); InputStream in = null; OutputStream out = null; @@ -91,13 +89,13 @@ public final class AssetCopyService extends IntentService } catch (IOException e) { - Log.e(TAG, "Failed to copy asset file: " + asset, e); + Log.error("[AssetCopyService] Failed to copy asset file: " + asset + e.getMessage()); } } private void copyAssetFolder(String assetFolder, String outputFolder) { - Log.v(TAG, "Copying " + assetFolder + " to " + outputFolder); + Log.verbose("[AssetCopyService] Copying " + assetFolder + " to " + outputFolder); try { @@ -108,7 +106,7 @@ public final class AssetCopyService extends IntentService } catch (IOException e) { - Log.e(TAG, "Failed to copy asset folder: " + assetFolder, e); + Log.error("[AssetCopyService] Failed to copy asset folder: " + assetFolder + e.getMessage()); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SettingsSaveService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SettingsSaveService.java index 1cf018ed16..5be3f4d27c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SettingsSaveService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SettingsSaveService.java @@ -2,8 +2,8 @@ package org.dolphinemu.dolphinemu.services; import android.app.IntentService; import android.content.Intent; -import android.util.Log; +import org.dolphinemu.dolphinemu.utils.Log; import org.dolphinemu.dolphinemu.utils.UserPreferences; /** @@ -13,8 +13,6 @@ import org.dolphinemu.dolphinemu.utils.UserPreferences; */ public final class SettingsSaveService extends IntentService { - private static final String TAG = "DolphinEmulator"; - public SettingsSaveService() { super("SettingsSaveService"); @@ -23,8 +21,8 @@ public final class SettingsSaveService extends IntentService @Override protected void onHandleIntent(Intent intent) { - Log.v(TAG, "Saving settings to INI files..."); + Log.verbose("[SettingsSaveService] Saving settings to INI files..."); UserPreferences.SavePrefsToIni(this); - Log.v(TAG, "Save successful."); + Log.verbose("[SettingsSaveService] Save successful."); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/PlatformGamesPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/PlatformGamesPresenter.java index 647bdd1a7b..5dda2e5535 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/PlatformGamesPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/PlatformGamesPresenter.java @@ -2,10 +2,10 @@ package org.dolphinemu.dolphinemu.ui.platform; import android.database.Cursor; -import android.util.Log; import org.dolphinemu.dolphinemu.DolphinApplication; import org.dolphinemu.dolphinemu.model.GameDatabase; +import org.dolphinemu.dolphinemu.utils.Log; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; @@ -34,13 +34,13 @@ public final class PlatformGamesPresenter public void refresh() { - Log.d("DolphinEmu", "[PlatformGamesPresenter] " + mPlatform + ": Refreshing..."); + Log.debug("[PlatformGamesPresenter] " + mPlatform + ": Refreshing..."); loadGames(); } private void loadGames() { - Log.d("DolphinEmu", "[PlatformGamesPresenter] " + mPlatform + ": Loading games..."); + Log.debug("[PlatformGamesPresenter] " + mPlatform + ": Loading games..."); GameDatabase databaseHelper = DolphinApplication.databaseHelper; @@ -52,7 +52,7 @@ public final class PlatformGamesPresenter @Override public void call(Cursor games) { - Log.d("DolphinEmu", "[PlatformGamesPresenter] " + mPlatform + ": Load finished, swapping cursor..."); + Log.debug("[PlatformGamesPresenter] " + mPlatform + ": Load finished, swapping cursor..."); mView.showGames(games); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/CPUHelper.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/CPUHelper.java index 30be6e2213..6fc6ce4008 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/CPUHelper.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/CPUHelper.java @@ -1,15 +1,15 @@ package org.dolphinemu.dolphinemu.utils; +import android.content.Context; +import android.os.Build; + +import org.dolphinemu.dolphinemu.R; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; -import org.dolphinemu.dolphinemu.R; - -import android.content.Context; -import android.os.Build; -import android.util.Log; /** * Utility class for retrieving information @@ -60,12 +60,12 @@ public final class CPUHelper } else { - Log.e("CPUHelper", "CPU architecture not supported yet."); + Log.error("[CPUHelper] CPU architecture not supported yet."); } } catch (IOException ioe) { - Log.e("CPUHelper", ioe.getMessage()); + Log.error("[CPUHelper] " + ioe.getMessage()); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/EGLHelper.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/EGLHelper.java index 24d192d412..aab32a6bb9 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/EGLHelper.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/EGLHelper.java @@ -6,6 +6,10 @@ package org.dolphinemu.dolphinemu.utils; +import android.opengl.GLES30; + +import org.dolphinemu.dolphinemu.NativeLibrary; + import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; @@ -13,11 +17,6 @@ import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL10; -import android.opengl.GLES30; -import android.util.Log; - -import org.dolphinemu.dolphinemu.NativeLibrary; - /** * Utility class that abstracts all the stuff about * EGL initialization out of the way if all that is @@ -90,12 +89,12 @@ public final class EGLHelper } else { - Log.e("EGLHelper", "Error initializing EGL."); + Log.error("[EGLHelper] Error initializing EGL."); } } else { - Log.e("EGLHelper", "Error initializing EGL display."); + Log.error("[EGLHelper] Error initializing EGL display."); } } @@ -232,7 +231,7 @@ public final class EGLHelper int[] numConfigs = new int[1]; if (!mEGL.eglGetConfigs(mDisplay, null, 0, numConfigs)) { - Log.e("EGLHelper", "Error retrieving number of EGL configs available."); + Log.error("[EGLHelper] Error retrieving number of EGL configs available."); return false; } @@ -240,7 +239,7 @@ public final class EGLHelper mEGLConfigs = new EGLConfig[numConfigs[0]]; if (!mEGL.eglGetConfigs(mDisplay, mEGLConfigs, mEGLConfigs.length, numConfigs)) { - Log.e("EGLHelper", "Error retrieving all EGL configs."); + Log.error("[EGLHelper] Error retrieving all EGL configs."); return false; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Log.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Log.java new file mode 100644 index 0000000000..666b528a88 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Log.java @@ -0,0 +1,54 @@ +package org.dolphinemu.dolphinemu.utils; + + +import org.dolphinemu.dolphinemu.BuildConfig; + +/** + * Contains methods that call through to {@link android.util.Log}, but + * with the same TAG automatically provided. Also no-ops VERBOSE and DEBUG log + * levels in release builds. + */ +public final class Log +{ + private static final String TAG = "Dolphin"; + + private Log() + { + } + + public static void verbose(String message) + { + if (BuildConfig.DEBUG) + { + android.util.Log.v(TAG, message); + } + } + + public static void debug(String message) + { + if (BuildConfig.DEBUG) + { + android.util.Log.d(TAG, message); + } + } + + public static void info(String message) + { + android.util.Log.i(TAG, message); + } + + public static void warning(String message) + { + android.util.Log.w(TAG, message); + } + + public static void error(String message) + { + android.util.Log.e(TAG, message); + } + + public static void wtf(String message) + { + android.util.Log.wtf(TAG, message); + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index c823096858..51b4553088 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -6,7 +6,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; -import android.util.Log; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.activities.EmulationActivity;