summaryrefslogtreecommitdiffstats
path: root/mobile/android/thirdparty/com/adjust/sdk/Logger.java
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mobile/android/thirdparty/com/adjust/sdk/Logger.java
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/thirdparty/com/adjust/sdk/Logger.java')
-rw-r--r--mobile/android/thirdparty/com/adjust/sdk/Logger.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/mobile/android/thirdparty/com/adjust/sdk/Logger.java b/mobile/android/thirdparty/com/adjust/sdk/Logger.java
new file mode 100644
index 000000000..86a644d4a
--- /dev/null
+++ b/mobile/android/thirdparty/com/adjust/sdk/Logger.java
@@ -0,0 +1,107 @@
+//
+// Logger.java
+// Adjust
+//
+// Created by Christian Wellenbrock on 2013-04-18.
+// Copyright (c) 2013 adjust GmbH. All rights reserved.
+// See the file MIT-LICENSE for copying permission.
+//
+
+package com.adjust.sdk;
+
+import android.util.Log;
+
+import java.util.Arrays;
+import java.util.Locale;
+
+import static com.adjust.sdk.Constants.LOGTAG;
+
+public class Logger implements ILogger {
+
+ private LogLevel logLevel;
+ private static String formatErrorMessage = "Error formating log message: %s, with params: %s";
+
+ public Logger() {
+ setLogLevel(LogLevel.INFO);
+ }
+
+ @Override
+ public void setLogLevel(LogLevel logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ @Override
+ public void setLogLevelString(String logLevelString) {
+ if (null != logLevelString) {
+ try {
+ setLogLevel(LogLevel.valueOf(logLevelString.toUpperCase(Locale.US)));
+ } catch (IllegalArgumentException iae) {
+ error("Malformed logLevel '%s', falling back to 'info'", logLevelString);
+ }
+ }
+ }
+
+ @Override
+ public void verbose(String message, Object... parameters) {
+ if (logLevel.androidLogLevel <= Log.VERBOSE) {
+ try {
+ Log.v(LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+ }
+
+ @Override
+ public void debug(String message, Object... parameters) {
+ if (logLevel.androidLogLevel <= Log.DEBUG) {
+ try {
+ Log.d(LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+ }
+
+ @Override
+ public void info(String message, Object... parameters) {
+ if (logLevel.androidLogLevel <= Log.INFO) {
+ try {
+ Log.i(LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+ }
+
+ @Override
+ public void warn(String message, Object... parameters) {
+ if (logLevel.androidLogLevel <= Log.WARN) {
+ try {
+ Log.w(LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+ }
+
+ @Override
+ public void error(String message, Object... parameters) {
+ if (logLevel.androidLogLevel <= Log.ERROR) {
+ try {
+ Log.e(LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+ }
+
+ @Override
+ public void Assert(String message, Object... parameters) {
+ try {
+ Log.println(Log.ASSERT, LOGTAG, String.format(message, parameters));
+ } catch (Exception e) {
+ Log.e(LOGTAG, String.format(formatErrorMessage, message, Arrays.toString(parameters)));
+ }
+ }
+}