mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Added: Add Logger.logInfoAndShowToast() and log messages even if not showing toast due to null Context
This commit is contained in:
@@ -195,9 +195,20 @@ public class Logger {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void logErrorAndShowToast(Context context, String tag, String message) {
|
public static void logInfoAndShowToast(Context context, String tag, String message) {
|
||||||
if (context == null) return;
|
if (CURRENT_LOG_LEVEL >= LOG_LEVEL_NORMAL) {
|
||||||
|
logInfo(tag, message);
|
||||||
|
showToast(context, message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logInfoAndShowToast(Context context, String message) {
|
||||||
|
logInfoAndShowToast(context, DEFAULT_LOG_TAG, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void logErrorAndShowToast(Context context, String tag, String message) {
|
||||||
if (CURRENT_LOG_LEVEL >= LOG_LEVEL_NORMAL) {
|
if (CURRENT_LOG_LEVEL >= LOG_LEVEL_NORMAL) {
|
||||||
logError(tag, message);
|
logError(tag, message);
|
||||||
showToast(context, message, true);
|
showToast(context, message, true);
|
||||||
@@ -211,8 +222,6 @@ public class Logger {
|
|||||||
|
|
||||||
|
|
||||||
public static void logDebugAndShowToast(Context context, String tag, String message) {
|
public static void logDebugAndShowToast(Context context, String tag, String message) {
|
||||||
if (context == null) return;
|
|
||||||
|
|
||||||
if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) {
|
if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) {
|
||||||
logDebug(tag, message);
|
logDebug(tag, message);
|
||||||
showToast(context, message, true);
|
showToast(context, message, true);
|
||||||
|
Reference in New Issue
Block a user