[android] Made all logging through new logging system

This commit is contained in:
alexzatsepin 2017-01-31 16:33:56 +03:00 committed by Aleksandr Zatsepin
parent 7732d543ce
commit 8efd71f46b
11 changed files with 88 additions and 137 deletions

View file

@ -9,7 +9,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
@ -34,6 +33,8 @@ import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.concurrency.ThreadPool;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.Statistics;
import java.io.File;
@ -45,6 +46,7 @@ import java.util.List;
@SuppressLint("StringFormatMatches")
public class DownloadResourcesActivity extends BaseMwmFragmentActivity
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.DOWNLOADER);
private static final String TAG = DownloadResourcesActivity.class.getName();
static final String EXTRA_COUNTRY = "country";
@ -503,7 +505,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
public boolean process(Intent intent)
{
final String url = intent.getData().toString();
Log.i(TAG, "Query = " + url);
LOGGER.i(TAG, "Query = " + url);
mMapTaskToForward = new OpenUrlTask(url);
org.alohalytics.Statistics.logEvent("GeoIntentProcessor::process", url);
return true;
@ -522,7 +524,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
public boolean process(Intent intent)
{
final String url = intent.getData().toString();
Log.i(TAG, "URL = " + url);
LOGGER.i(TAG, "URL = " + url);
mMapTaskToForward = new OpenUrlTask(url);
org.alohalytics.Statistics.logEvent("Ge0IntentProcessor::process", url);
return true;
@ -548,7 +550,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
public boolean process(Intent intent)
{
final Uri data = intent.getData();
Log.i(TAG, "URL = " + data.toString());
LOGGER.i(TAG, "URL = " + data.toString());
final String ge0Url = "ge0:/" + data.getPath();
mMapTaskToForward = new OpenUrlTask(ge0Url);
@ -603,7 +605,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
public boolean process(Intent intent)
{
final String url = intent.getData().toString();
Log.i(TAG, "URL = " + url);
LOGGER.i(TAG, "URL = " + url);
mMapTaskToForward = new OpenUrlTask(url);
org.alohalytics.Statistics.logEvent("GoogleMapsIntentProcessor::process", url);
return true;
@ -703,7 +705,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
}
} catch (final Exception ex)
{
Log.w(TAG, "Attachment not found or io error: " + ex);
LOGGER.w(TAG, "Attachment not found or io error: " + ex, ex);
} finally
{
Utils.closeStream(input);
@ -716,11 +718,11 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
boolean result = false;
if (path != null)
{
Log.d(TAG, "Loading bookmarks file from: " + path);
LOGGER.d(TAG, "Loading bookmarks file from: " + path);
result = BookmarkManager.nativeLoadKmzFile(path);
}
else
Log.w(TAG, "Can't get bookmarks file from URI: " + mData);
LOGGER.w(TAG, "Can't get bookmarks file from URI: " + mData);
if (tmpFile != null)
//noinspection ResultOfMethodCallIgnored

View file

@ -9,7 +9,6 @@ import android.os.Message;
import android.preference.PreferenceManager;
import android.support.annotation.UiThread;
import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.util.List;
@ -32,6 +31,8 @@ import com.mapswithme.util.Constants;
import com.mapswithme.util.ThemeSwitcher;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.PushwooshHelper;
import com.mapswithme.util.statistics.Statistics;
import com.my.tracker.MyTracker;
@ -42,6 +43,7 @@ import net.hockeyapp.android.CrashManager;
public class MwmApplication extends Application
{
private static Logger sLogger;
private final static String TAG = "MwmApplication";
private static final String PW_EMPTY_APP_ID = "XXXXX";
@ -111,6 +113,7 @@ public class MwmApplication extends Application
public void onCreate()
{
super.onCreate();
sLogger = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
mMainLoopHandler = new Handler(getMainLooper());
initHockeyApp();
@ -123,8 +126,11 @@ public class MwmApplication extends Application
initTracker();
String settingsPath = getSettingsPath();
sLogger.d(TAG, "onCreate(), setting path = " + settingsPath);
String tempPath = getTempPath();
sLogger.d(TAG, "onCreate(), temp path = " + tempPath);
new File(settingsPath).mkdirs();
new File(getTempPath()).mkdirs();
new File(tempPath).mkdirs();
// First we need initialize paths and platform to have access to settings and other components.
nativePreparePlatform(settingsPath);
@ -231,7 +237,7 @@ public class MwmApplication extends Application
return getPackageManager().getApplicationInfo(BuildConfig.APPLICATION_ID, 0).sourceDir;
} catch (final NameNotFoundException e)
{
Log.e(TAG, "Can't get apk path from PackageManager");
sLogger.e(TAG, "Can't get apk path from PackageManager", e);
return "";
}
}
@ -296,7 +302,7 @@ public class MwmApplication extends Application
}
catch(Exception e)
{
Log.e("Pushwoosh", e.getLocalizedMessage());
sLogger.e("Pushwoosh", "Failed to init Pushwoosh", e);
}
}
@ -312,7 +318,7 @@ public class MwmApplication extends Application
}
catch(Exception e)
{
Log.e("Pushwoosh", e.getLocalizedMessage());
sLogger.e("Pushwoosh", "Failed to send pushwoosh tags", e);
}
}

View file

@ -2,7 +2,6 @@ package com.mapswithme.maps.downloader;
import android.os.AsyncTask;
import android.util.Base64;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.DataOutputStream;
@ -18,10 +17,13 @@ import java.util.concurrent.Executors;
import com.mapswithme.util.Constants;
import com.mapswithme.util.StringUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
@SuppressWarnings("unused")
class ChunkTask extends AsyncTask<Void, byte[], Boolean>
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.DOWNLOADER);
private static final String TAG = "ChunkTask";
private static final int TIMEOUT_IN_SECONDS = 60;
@ -190,7 +192,7 @@ class ChunkTask extends AsyncTask<Void, byte[], Boolean>
{
// we've set error code so client should be notified about the error
mHttpErrorCode = FILE_SIZE_CHECK_FAILED;
Log.w(TAG, "Error for " + urlConnection.getURL() +
LOGGER.w(TAG, "Error for " + urlConnection.getURL() +
": Server replied with code " + err +
", aborting download. " + Utils.mapPrettyPrint(requestParams));
return false;
@ -208,7 +210,7 @@ class ChunkTask extends AsyncTask<Void, byte[], Boolean>
{
// we've set error code so client should be notified about the error
mHttpErrorCode = FILE_SIZE_CHECK_FAILED;
Log.w(TAG, "Error for " + urlConnection.getURL() +
LOGGER.w(TAG, "Error for " + urlConnection.getURL() +
": Invalid file size received (" + contentLength + ") while expecting " + mExpectedFileSize +
". Aborting download.");
return false;
@ -219,13 +221,13 @@ class ChunkTask extends AsyncTask<Void, byte[], Boolean>
return downloadFromStream(new BufferedInputStream(urlConnection.getInputStream(), 65536));
} catch (final MalformedURLException ex)
{
Log.d(TAG, "Invalid url: " + mUrl);
LOGGER.e(TAG, "Invalid url: " + mUrl, ex);
mHttpErrorCode = INVALID_URL;
return false;
} catch (final IOException ex)
{
Log.d(TAG, "IOException in doInBackground for URL: " + mUrl, ex);
LOGGER.d(TAG, "IOException in doInBackground for URL: " + mUrl, ex);
mHttpErrorCode = IO_ERROR;
return false;
@ -253,7 +255,7 @@ class ChunkTask extends AsyncTask<Void, byte[], Boolean>
break;
} catch (final IOException ex)
{
Log.d(TAG, "IOException in downloadFromStream for chunk size: " + size, ex);
LOGGER.e(TAG, "IOException in downloadFromStream for chunk size: " + size, ex);
}
}

View file

@ -12,7 +12,17 @@ import android.os.Build;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.util.Config;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.concurrency.ThreadPool;
import com.mapswithme.util.concurrency.UiThread;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import java.io.File;
import java.io.FileFilter;
@ -23,17 +33,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.util.Config;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.concurrency.ThreadPool;
import com.mapswithme.util.concurrency.UiThread;
public class StoragePathManager
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.STORAGE);
private static final String[] MOVABLE_EXTS = Framework.nativeGetMovableFilesExts();
static final FilenameFilter MOVABLE_FILES_FILTER = new FilenameFilter()
{
@ -169,10 +171,10 @@ public class StoragePathManager
if (mCurrentStorageIndex == -1)
{
Log.w(TAG, "Unrecognized current path : " + currentStorage);
Log.w(TAG, "Parsed paths : ");
LOGGER.w(TAG, "Unrecognized current path : " + currentStorage);
LOGGER.w(TAG, "Parsed paths : ");
for (StorageItem item : mItems)
Log.w(TAG, item.toString());
LOGGER.w(TAG, item.toString());
}
}
@ -192,13 +194,13 @@ public class StoragePathManager
final long freeSize = StorageUtils.getFreeBytesAtPath(path);
if (freeSize > 0)
{
Log.i(TAG, "Storage found : " + path + ", size : " + freeSize);
LOGGER.i(TAG, "Storage found : " + path + ", size : " + freeSize);
return new StorageItem(path, freeSize);
}
}
} catch (final IllegalArgumentException ex)
{
Log.i(TAG, "Can't build storage for path : " + path);
LOGGER.e(TAG, "Can't build storage for path : " + path, ex);
}
return null;
@ -213,7 +215,7 @@ public class StoragePathManager
final File f = new File(path);
if (!f.exists() && !f.mkdirs())
{
Log.e(TAG, "Can't create directory: " + path);
LOGGER.e(TAG, "Can't create directory: " + path);
return;
}
@ -408,7 +410,7 @@ public class StoragePathManager
// According to changeStorage code above, oldStorage can be null.
if (oldStorage == null)
{
Log.w(TAG, "Old storage path is null. New path is: " + fullNewPath);
LOGGER.w(TAG, "Old storage path is null. New path is: " + fullNewPath);
return NULL_ERROR;
}

View file

@ -3,7 +3,14 @@ package com.mapswithme.maps.settings;
import android.annotation.TargetApi;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.util.Constants;
import com.mapswithme.util.Utils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
@ -17,16 +24,12 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.util.Constants;
import com.mapswithme.util.Utils;
final class StorageUtils
{
private StorageUtils() {}
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.STORAGE);
private static final String TAG = StorageUtils.class.getSimpleName();
private static final int VOLD_MODE = 1;
private static final int MOUNTS_MODE = 2;
@ -39,7 +42,7 @@ final class StorageUtils
* @return result
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
public static boolean isDirWritable(String path)
static boolean isDirWritable(String path)
{
File f = new File(path, "mapsme_test_dir");
f.mkdir();
@ -83,7 +86,7 @@ final class StorageUtils
// http://stackoverflow.com/questions/14212969/file-canwrite-returns-false-on-some-devices-although-write-external-storage-pe
private static void parseMountFile(String file, int mode, Set<String> paths)
{
Log.i(StoragePathManager.TAG, "Parsing " + file);
LOGGER.i(StoragePathManager.TAG, "Parsing " + file);
BufferedReader reader = null;
try
@ -125,7 +128,7 @@ final class StorageUtils
}
} catch (final IOException e)
{
Log.w(StoragePathManager.TAG, "Can't read file: " + file);
LOGGER.w(TAG, "Can't read file: " + file, e);
} finally
{
Utils.closeStream(reader);
@ -153,7 +156,7 @@ final class StorageUtils
// add only secondary dirs
if (f != null && !f.equals(primaryStorage))
{
Log.i(StoragePathManager.TAG, "Additional storage path: " + f.getPath());
LOGGER.i(StoragePathManager.TAG, "Additional storage path: " + f.getPath());
paths.add(f.getPath());
}
}
@ -164,10 +167,10 @@ final class StorageUtils
String suffix = String.format(Constants.STORAGE_PATH, BuildConfig.APPLICATION_ID, Constants.FILES_DIR);
for (String testStorage : testStorages)
{
Log.i(StoragePathManager.TAG, "Test storage from config files : " + testStorage);
LOGGER.i(StoragePathManager.TAG, "Test storage from config files : " + testStorage);
if (isDirWritable(testStorage))
{
Log.i(StoragePathManager.TAG, "Found writable storage : " + testStorage);
LOGGER.i(StoragePathManager.TAG, "Found writable storage : " + testStorage);
paths.add(testStorage);
}
else
@ -176,14 +179,14 @@ final class StorageUtils
File file = new File(testStorage);
if (!file.exists()) // create directory for our package if it isn't created by any reason
{
Log.i(StoragePathManager.TAG, "Try to create MWM path");
LOGGER.i(StoragePathManager.TAG, "Try to create MWM path");
if (file.mkdirs())
Log.i(StoragePathManager.TAG, "Created!");
LOGGER.i(StoragePathManager.TAG, "Created!");
}
if (isDirWritable(testStorage))
{
Log.i(StoragePathManager.TAG, "Found writable storage : " + testStorage);
LOGGER.i(StoragePathManager.TAG, "Found writable storage : " + testStorage);
paths.add(testStorage);
}
}

View file

@ -6,7 +6,6 @@ import android.speech.tts.TextToSpeech;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
@ -16,6 +15,8 @@ import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.util.Config;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.Statistics;
/**
@ -37,6 +38,8 @@ public enum TtsPlayer
{
INSTANCE;
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = TtsPlayer.class.getSimpleName();
private static final Locale DEFAULT_LOCALE = Locale.US;
private static final float SPEECH_RATE = 1.2f;
@ -145,7 +148,7 @@ public enum TtsPlayer
{
if (status == TextToSpeech.ERROR)
{
Log.e("TtsPlayer", "Failed to initialize TextToSpeach");
LOGGER.e(TAG, "Failed to initialize TextToSpeach");
lockDown();
mInitializing = false;
return;
@ -225,9 +228,12 @@ public enum TtsPlayer
{
outList.add(new LanguageData(codes[i], names[i], mTts));
}
catch (LanguageData.NotAvailableException ignored) {}
catch (LanguageData.NotAvailableException ignored) {
LOGGER.e(TAG, "Failed to get usable languages", ignored);
}
catch (IllegalArgumentException e)
{
LOGGER.e(TAG, "Failed to get usable languages", e);
reportFailure(e, "getUsableLanguages()");
lockDown();
return false;

View file

@ -2,7 +2,6 @@ package com.mapswithme.maps.traffic;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.util.Log;
import com.mapswithme.util.Utils;
import com.mapswithme.util.log.Logger;
@ -92,7 +91,7 @@ public enum TrafficManager
if (mCallbacks.isEmpty())
{
Log.w(mTag, "There are no attached callbacks. Invoke the 'detachAll' method " +
mLogger.w(mTag, "There are no attached callbacks. Invoke the 'detachAll' method " +
"only when it's really needed!", new Throwable());
return;
}

View file

@ -6,7 +6,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

View file

@ -7,13 +7,11 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DimenRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
@ -23,7 +21,6 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.util.Log;
import android.view.Window;
import android.widget.Toast;
@ -33,6 +30,7 @@ import com.mapswithme.maps.R;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
import com.mapswithme.maps.uber.UberLinks;
import com.mapswithme.util.concurrency.UiThread;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.AlohaHelper;
@ -43,12 +41,12 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class Utils
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = "Utils";
public interface Proc<T>
@ -67,7 +65,7 @@ public class Utils
stream.close();
} catch (final IOException e)
{
Log.e(TAG, "Can't close stream", e);
LOGGER.e(TAG, "Can't close stream", e);
}
}
}
@ -77,21 +75,6 @@ public class Utils
return "Amazon".equalsIgnoreCase(Build.MANUFACTURER);
}
public static boolean hasAnyGoogleStoreInstalled()
{
final String GooglePlayStorePackageNameOld = "com.google.market";
final String GooglePlayStorePackageNameNew = "com.android.vending";
final PackageManager pm = MwmApplication.get().getPackageManager();
final List<PackageInfo> packages = pm.getInstalledPackages(0);
for (final PackageInfo packageInfo : packages)
{
if (packageInfo.packageName.equals(GooglePlayStorePackageNameOld)
|| packageInfo.packageName.equals(GooglePlayStorePackageNameNew))
return true;
}
return false;
}
/**
* Enable to keep screen on.
* Disable to let system turn it off automatically.
@ -154,11 +137,6 @@ public class Utils
return "[" + joined + "]";
}
public static Object[] asObjectArray(Object... args)
{
return args;
}
public static boolean isPackageInstalled(String packageUri)
{
PackageManager pm = MwmApplication.get().getPackageManager();
@ -174,19 +152,6 @@ public class Utils
return installed;
}
public static void launchPackage(Activity activity, String appPackage)
{
final Intent intent = activity.getPackageManager().getLaunchIntentForPackage(appPackage);
if (intent != null)
activity.startActivity(intent);
}
public static boolean isIntentAvailable(Intent intent)
{
PackageManager mgr = MwmApplication.get().getPackageManager();
return mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
}
public static Uri buildMailUri(String to, String subject, String body)
{
String uriString = Constants.Url.MAILTO_SCHEME + Uri.encode(to) +
@ -201,7 +166,7 @@ public class Utils
*
* @return name of the logfile. May be null in case of error.
*/
public static String saveLogToFile()
private static String saveLogToFile()
{
String fullName = MwmApplication.getSettingsPath() + "logcat.txt";
File file = new File(fullName);
@ -255,23 +220,6 @@ public class Utils
return model;
}
/**
* @param timestamp in currentTimeMillis() format
*/
public static boolean isInstalledAfter(long timestamp)
{
try
{
final PackageInfo info = MwmApplication.get().getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, 0);
return info.firstInstallTime > timestamp;
} catch (PackageManager.NameNotFoundException e)
{
e.printStackTrace();
}
return false;
}
public static void openAppInMarket(Activity activity, String url)
{
final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
@ -321,19 +269,6 @@ public class Utils
NavUtils.navigateUpFromSameTask(activity);
}
public static void navigateToParent(@NonNull Activity activity, @NonNull Bundle extras)
{
if (activity instanceof CustomNavigateUpListener)
{
((CustomNavigateUpListener) activity).customOnNavigateUp();
return;
}
final Intent intent = NavUtils.getParentActivityIntent(activity);
intent.putExtras(extras);
NavUtils.navigateUpTo(activity, intent);
}
public static SpannableStringBuilder formatUnitsText(Context context, @DimenRes int size, @DimenRes int units, String dimension, String unitText)
{
final SpannableStringBuilder res = new SpannableStringBuilder(dimension).append(" ").append(unitText);
@ -438,6 +373,7 @@ public class Utils
}
catch (ActivityNotFoundException e)
{
LOGGER.e(TAG, "Failed to call phone", e);
AlohaHelper.logException(e);
}
}

View file

@ -19,7 +19,7 @@ public class LoggerFactory
{
public enum Type
{
MISC, LOCATION, TRAFFIC, GPS_TRACKING, TRACK_RECORDER, ROUTING, NETWORK;
MISC, LOCATION, TRAFFIC, GPS_TRACKING, TRACK_RECORDER, ROUTING, NETWORK, STORAGE, DOWNLOADER
}
public interface OnZipCompletedListener
@ -35,7 +35,6 @@ public class LoggerFactory
}
public final static LoggerFactory INSTANCE = new LoggerFactory();
private final static String TAG = LoggerFactory.class.getSimpleName();
@NonNull
@GuardedBy("this")

View file

@ -4,8 +4,9 @@ import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.pushwoosh.PushManager;
import com.pushwoosh.SendPushTagsCallBack;
@ -17,6 +18,7 @@ import java.util.Map;
public final class PushwooshHelper implements SendPushTagsCallBack
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final PushwooshHelper sInstance = new PushwooshHelper();
private WeakReference<Context> mContext;
@ -42,11 +44,6 @@ public final class PushwooshHelper implements SendPushTagsCallBack
sendTags(null);
}
public void sendTag(String tag)
{
sendTag(tag, "1");
}
public void sendTag(String tag, Object value)
{
Map<String, Object> tags = new HashMap<>();
@ -54,7 +51,7 @@ public final class PushwooshHelper implements SendPushTagsCallBack
sendTags(tags);
}
public void sendTags(Map<String, Object> tags)
private void sendTags(Map<String, Object> tags)
{
synchronized (mSyncObject)
{
@ -127,7 +124,7 @@ public final class PushwooshHelper implements SendPushTagsCallBack
if (e != null)
{
String msg = e.getLocalizedMessage();
Log.e("Pushwoosh", msg != null ? msg : "onSentTagsError");
LOGGER.e("Pushwoosh", msg != null ? msg : "onSentTagsError");
}
mTask = null;
}