Java Code Examples for android.util.Log#getStackTraceString()
The following examples show how to use
android.util.Log#getStackTraceString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxBleLog.java From RxAndroidBle with Apache License 2.0 | 6 votes |
private static void throwShade(int priority, Throwable t, String message, Object... args) { if (priority < loggerSetup.logLevel) { return; } final String formattedMessage = formatString(message, args); final String finalMessage; if (formattedMessage == null || formattedMessage.length() == 0) { if (t != null) { finalMessage = Log.getStackTraceString(t); } else { // Swallow message if it's null and there's no throwable. return; } } else if (t != null) { finalMessage = formattedMessage + "\n" + Log.getStackTraceString(t); } else { finalMessage = formattedMessage; } String tag = createTag(); println(priority, tag, finalMessage); }
Example 2
Source File: LogWrapper.java From fit-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 3
Source File: LogWrapper.java From user-interface-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 4
Source File: LogWrapper.java From animation-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 5
Source File: LogWrapper.java From user-interface-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 6
Source File: LogWrapper.java From fit-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 7
Source File: LogWrapper.java From graphics-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 8
Source File: LogWrapper.java From media-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 9
Source File: LogWrapper.java From android-DragAndDropAcrossApps with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging * facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 10
Source File: LogWrapper.java From user-interface-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging * facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 11
Source File: LogWrapper.java From user-interface-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 12
Source File: LogWrapper.java From media-samples with Apache License 2.0 | 6 votes |
/** * Prints data out to the console using Android's native log mechanism. * @param priority Log level of the data being logged. Verbose, Error, etc. * @param tag Tag for for the log data. Can be used to organize log statements. * @param msg The actual message to be logged. The actual message to be logged. * @param tr If an exception was thrown, this can be sent along for the logging facilities * to extract and print useful information. */ @Override public void println(int priority, String tag, String msg, Throwable tr) { // There actually are log methods that don't take a msg parameter. For now, // if that's the case, just convert null to the empty string and move on. String useMsg = msg; if (useMsg == null) { useMsg = ""; } // If an exeption was provided, convert that exception to a usable string and attach // it to the end of the msg method. if (tr != null) { msg += "\n" + Log.getStackTraceString(tr); } // This is functionally identical to Log.x(tag, useMsg); // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) Log.println(priority, tag, useMsg); // If this isn't the last node in the chain, move things along. if (mNext != null) { mNext.println(priority, tag, msg, tr); } }
Example 13
Source File: BugCollector.java From QNotified with GNU General Public License v3.0 | 5 votes |
public static void onThrowable(Throwable th) { try { long time = System.currentTimeMillis(); String logstr = Log.getStackTraceString(th); int hash = logstr.hashCode(); } catch (Throwable ignored) { } }
Example 14
Source File: MyLogImp.java From HotFixDemo with MIT License | 5 votes |
@Override public void printErrStackTrace(String s, Throwable throwable, String s1, Object... objects) { String log = objects == null ? s1 : String.format(s1, objects); if (log == null) { log = ""; } log = log + " " + Log.getStackTraceString(throwable); Log.e(s, log); }
Example 15
Source File: VoiceCallEngine.java From NaviBee with GNU General Public License v3.0 | 5 votes |
private VoiceCallEngine() { try { mRtcEngine = RtcEngine.create(NaviBeeApplication.getInstance().getBaseContext(), NaviBeeApplication.getInstance().getString(R.string.agora_app_id), mRtcEventHandler); } catch (Exception e) { Log.e(LOG_TAG, Log.getStackTraceString(e)); throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e)); } mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION); }
Example 16
Source File: DumpUtils.java From sctalk with Apache License 2.0 | 5 votes |
public static void dumpStacktrace(Logger logger, String desc, boolean oneLine) { String stackTraceString = Log.getStackTraceString(new Throwable()); if (oneLine) { stackTraceString = stackTraceString.replace("\n", "####"); } logger.d("%s:%s", desc, stackTraceString); }
Example 17
Source File: XLog.java From XposedSmsCode with GNU General Public License v3.0 | 5 votes |
private static void log(int priority, String message, Object... args) { if (priority < sLogLevel) return; message = String.format(message, args); if (args.length > 0 && args[args.length - 1] instanceof Throwable) { Throwable throwable = (Throwable) args[args.length - 1]; String stacktraceStr = Log.getStackTraceString(throwable); message += '\n' + stacktraceStr; } // Write to the default log tag Log.println(priority, LOG_TAG, message); // Duplicate to the Xposed log if enabled if (LOG_TO_XPOSED) { if (priority <= Log.DEBUG) { // DEBUG level 不会在Xposed日志中生成,所以调整等级 priority = Log.INFO; } Log.println(priority, "Xposed", LOG_TAG + ": " + message); } if (LOG_TO_EDXPOSED) { Log.println(priority, "EdXposed-Bridge", LOG_TAG + ": " + message); } }
Example 18
Source File: LogUtils.java From Ezalor with Apache License 2.0 | 4 votes |
public static void logwForce(Throwable e) { String msg = Log.getStackTraceString(e); Log.w(getCurrentAppTagForce(), msg); saveLogIfNeeded(getCurrentAppTagForce(), msg, "W"); }
Example 19
Source File: LogUtils.java From PreferencesProvider with Apache License 2.0 | 4 votes |
public static String getStackTraceString(Throwable tr) { return Log.getStackTraceString(tr); }
Example 20
Source File: VLog.java From Phantom with Apache License 2.0 | 4 votes |
public static String getStackTraceString(Throwable tr) { return Log.getStackTraceString(tr); }