123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- package com.epson.mobilephone.common;
- import android.os.Debug;
- import android.support.p000v4.media.session.PlaybackStateCompat;
- import android.util.Log;
- import epson.print.CommonDefine;
- import java.text.DecimalFormat;
- public final class EpLog {
- public static final String TAG = "Epson App";
- private static boolean isDebug = false;
- private static String null2str(String str) {
- return str == null ? "(null)" : str;
- }
- private EpLog() {
- }
- public static void setDebuggable(boolean z) {
- if (z) {
- isDebug = true;
- } else {
- isDebug = false;
- }
- }
- /* renamed from: v */
- public static void m79v() {
- if (isDebug) {
- Log.v("Epson App", getMetaInfo());
- }
- }
- /* renamed from: v */
- public static void m80v(String str) {
- if (isDebug) {
- Log.v("Epson App", getMetaInfo() + null2str(str));
- }
- }
- /* renamed from: v */
- public static void m81v(String str, String str2) {
- if (isDebug) {
- Log.v(str, getMetaInfo() + null2str(str2));
- }
- }
- /* renamed from: d */
- public static void m68d() {
- if (isDebug) {
- Log.d("Epson App", getMetaInfo());
- }
- }
- /* renamed from: d */
- public static void m69d(String str) {
- if (isDebug) {
- Log.d("Epson App", getMetaInfo() + null2str(str));
- }
- }
- /* renamed from: d */
- public static void m70d(String str, String str2) {
- if (isDebug) {
- Log.d(str, getMetaInfo() + null2str(str2));
- }
- }
- /* renamed from: i */
- public static void m76i() {
- if (isDebug) {
- Log.i("Epson App", getMetaInfo());
- }
- }
- /* renamed from: i */
- public static void m77i(String str) {
- if (isDebug) {
- Log.i("Epson App", getMetaInfo() + null2str(str));
- }
- }
- /* renamed from: i */
- public static void m78i(String str, String str2) {
- if (isDebug) {
- Log.i(str, getMetaInfo() + null2str(str2));
- }
- }
- /* renamed from: w */
- public static void m82w(String str) {
- if (isDebug) {
- Log.w("Epson App", getMetaInfo() + null2str(str));
- }
- }
- /* renamed from: w */
- public static void m83w(String str, String str2) {
- if (isDebug) {
- Log.w(str, getMetaInfo() + null2str(str2));
- }
- }
- /* renamed from: w */
- public static void m85w(String str, Throwable th) {
- if (isDebug) {
- Log.w("Epson App", getMetaInfo() + null2str(str), th);
- printThrowable(th);
- if (th.getCause() != null) {
- printThrowable(th.getCause());
- }
- }
- }
- /* renamed from: w */
- public static void m84w(String str, String str2, Throwable th) {
- if (isDebug) {
- Log.w(str, getMetaInfo() + null2str(str2), th);
- printThrowable(str, th);
- if (th.getCause() != null) {
- printThrowable(th.getCause());
- }
- }
- }
- /* renamed from: e */
- public static void m71e(String str) {
- if (isDebug) {
- Log.e("Epson App", getMetaInfo() + null2str(str));
- }
- }
- /* renamed from: e */
- public static void m72e(String str, String str2) {
- if (isDebug) {
- Log.e(str, getMetaInfo() + null2str(str2));
- }
- }
- /* renamed from: e */
- public static void m74e(String str, Throwable th) {
- if (isDebug) {
- Log.e("Epson App", getMetaInfo() + null2str(str), th);
- printThrowable(th);
- if (th.getCause() != null) {
- printThrowable(th.getCause());
- }
- }
- }
- /* renamed from: e */
- public static void m73e(String str, String str2, Throwable th) {
- if (isDebug) {
- Log.e(str, getMetaInfo() + null2str(str2), th);
- printThrowable(str, th);
- if (th.getCause() != null) {
- printThrowable(th.getCause());
- }
- }
- }
- /* renamed from: e */
- public static void m75e(Throwable th) {
- if (isDebug) {
- printThrowable(th);
- if (th.getCause() != null) {
- printThrowable(th.getCause());
- }
- }
- }
- private static void printThrowable(Throwable th) {
- Log.e("Epson App", th.getClass().getName() + ": " + th.getMessage());
- for (StackTraceElement stackTraceElement : th.getStackTrace()) {
- Log.e("Epson App", " at " + getMetaInfo(stackTraceElement));
- }
- }
- private static void printThrowable(String str, Throwable th) {
- Log.e(str, th.getClass().getName() + ": " + th.getMessage());
- for (StackTraceElement stackTraceElement : th.getStackTrace()) {
- Log.e("Epson App", " at " + getMetaInfo(stackTraceElement));
- }
- }
- private static String getMetaInfo() {
- return getMetaInfo(Thread.currentThread().getStackTrace()[4]);
- }
- public static String getMetaInfo(StackTraceElement stackTraceElement) {
- StringBuffer stringBuffer = new StringBuffer();
- String className = stackTraceElement.getClassName();
- String substring = className.substring(className.lastIndexOf(CommonDefine.DOT) + 1);
- String methodName = stackTraceElement.getMethodName();
- int lineNumber = stackTraceElement.getLineNumber();
- stringBuffer.append("[");
- stringBuffer.append(substring);
- stringBuffer.append("#");
- stringBuffer.append(methodName);
- stringBuffer.append(":");
- stringBuffer.append(lineNumber);
- stringBuffer.append("]");
- return new String(stringBuffer);
- }
- public static final void heap() {
- heap("Epson App");
- }
- public static final void heap(String str) {
- if (isDebug) {
- DecimalFormat decimalFormat = new DecimalFormat("0.00");
- StringBuffer stringBuffer = new StringBuffer();
- stringBuffer.append("Native heap : Free=");
- stringBuffer.append(Long.toString(Debug.getNativeHeapFreeSize() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID));
- stringBuffer.append("kb");
- stringBuffer.append(", Allocated=");
- stringBuffer.append(decimalFormat.format(((Debug.getNativeHeapAllocatedSize()) / 1024.0d) / 1024.0d));
- stringBuffer.append("MB");
- stringBuffer.append(", Size=");
- stringBuffer.append(decimalFormat.format(((Debug.getNativeHeapSize()) / 1024.0d) / 1024.0d));
- stringBuffer.append("MB");
- stringBuffer.append(System.getProperty("line.separator"));
- stringBuffer.append("Dalvik heap : Free=");
- stringBuffer.append(Long.toString(Runtime.getRuntime().freeMemory() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID));
- stringBuffer.append("kb");
- stringBuffer.append(", Total=");
- stringBuffer.append(decimalFormat.format(((Runtime.getRuntime().totalMemory()) / 1024.0d) / 1024.0d));
- stringBuffer.append("MB");
- stringBuffer.append(", Now Size=");
- stringBuffer.append(decimalFormat.format((((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())) / 1024.0d) / 1024.0d));
- stringBuffer.append("MB");
- stringBuffer.append(", MAX Size=");
- stringBuffer.append(decimalFormat.format(((Runtime.getRuntime().maxMemory()) / 1024.0d) / 1024.0d));
- stringBuffer.append("MB");
- Log.i(str, new String(stringBuffer));
- }
- }
- }
|