Java Code Examples for android.util.Log#INFO

The following examples show how to use android.util.Log#INFO . 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: RobolectricTestWithConfig.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private static String logTypeToString(int type) {
    switch (type) {
        case Log.ASSERT:
            return "Assert";
        case Log.DEBUG:
            return "Debug";
        case Log.ERROR:
            return "Error";
        case Log.WARN:
            return "Warn";
        case Log.INFO:
            return "Info";
        case Log.VERBOSE:
            return "Verbose";
        default:
            return "?";
    }
}
 
Example 2
Source File: App.java    From Resume-Builder with MIT License 6 votes vote down vote up
@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
    if (priority <= Log.INFO) {
        return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 3
Source File: LogLine.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private static int convertCharToLogLevel(char logLevelChar) {

        switch (logLevelChar) {
            case 'D':
                return Log.DEBUG;
            case 'E':
                return Log.ERROR;
            case 'I':
                return Log.INFO;
            case 'V':
                return Log.VERBOSE;
            case 'W':
                return Log.WARN;
            case 'F':
                return LogLineAdapterUtil.LOG_WTF; // 'F' actually stands for 'WTF', which is a real Android log level in 2.2
        }
        return -1;
    }
 
Example 4
Source File: RobolectricTestWithConfig.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private static String logTypeToString(int type) {
    switch (type) {
        case Log.ASSERT:
            return "Assert";
        case Log.DEBUG:
            return "Debug";
        case Log.ERROR:
            return "Error";
        case Log.WARN:
            return "Warn";
        case Log.INFO:
            return "Info";
        case Log.VERBOSE:
            return "Verbose";
        default:
            return "?";
    }
}
 
Example 5
Source File: LogInfoDokitView.java    From DoraemonKit with Apache License 2.0 6 votes vote down vote up
private int getSelectLogLevel() {
    int checkedId = mRadioGroup.getCheckedRadioButtonId();
    if (checkedId == R.id.verbose) {
        return Log.VERBOSE;
    } else if (checkedId == R.id.debug) {
        return Log.DEBUG;
    } else if (checkedId == R.id.info) {
        return Log.INFO;
    } else if (checkedId == R.id.warn) {
        return Log.WARN;
    } else if (checkedId == R.id.error) {
        return Log.ERROR;
    } else {
        return Log.VERBOSE;
    }
}
 
Example 6
Source File: SetupApplication.java    From octoandroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void log(int priority, String tag, String message, Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return;
    }

    if (Crashlytics.getInstance() == null) return; // Should never happen
    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 7
Source File: LogLine.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private static char convertLogLevelToChar(int logLevel) {

        switch (logLevel) {
            case Log.DEBUG:
                return 'D';
            case Log.ERROR:
                return 'E';
            case Log.INFO:
                return 'I';
            case Log.VERBOSE:
                return 'V';
            case Log.WARN:
                return 'W';
            case LogLineAdapterUtil.LOG_WTF:
                return 'F';
        }
        return ' ';
    }
 
Example 8
Source File: McuMgrBleTransport.java    From mcumgr-android with Apache License 2.0 6 votes vote down vote up
@Override
public void log(int priority, @NonNull String message) {
    if (mLoggingEnabled) {
        switch (priority) {
            case Log.DEBUG:
                LOG.debug(message);
                break;
            case Log.INFO:
                LOG.info(message);
                break;
            case Log.WARN:
                LOG.warn(message);
                break;
            case Log.ERROR:
            case Log.ASSERT:
                LOG.error(message);
                break;
            case Log.VERBOSE:
            default:
                LOG.trace(message);
                break;
        }
    }
}
 
Example 9
Source File: LogcatDumper.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
private int getLevel(@NonNull String log) {
    if(log.length() < 20){
        return 'V';
    }
    char level = log.charAt(19);
    switch (level) {
        case 'V':
            return Log.VERBOSE;
        case 'I':
            return Log.INFO;
        case 'D':
            return Log.DEBUG;
        case 'W':
            return Log.WARN;
        case 'E':
            return Log.ERROR;
    }
    return 0;
}
 
Example 10
Source File: P_BleManager_Listeners.java    From AsteroidOSSync with GNU General Public License v3.0 5 votes vote down vote up
private void onNativeBondStateChanged(Context context, Intent intent)
{
    final int previousState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, BluetoothDevice.ERROR);
    final int newState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR);
    int logLevel = newState == BluetoothDevice.ERROR || previousState == BluetoothDevice.ERROR ? Log.WARN : Log.INFO;
    m_mngr.getLogger().log(logLevel, "previous=" + m_mngr.getLogger().gattBondState(previousState) + " new=" + m_mngr.getLogger().gattBondState(newState));

    final int failReason;

    if (newState == BluetoothDevice.BOND_NONE)
    {
        //--- DRK > Can't access BluetoothDevice.EXTRA_REASON cause of stupid @hide annotation, so hardcoding string here.
        failReason = intent.getIntExtra(BluetoothDevice_EXTRA_REASON, BluetoothDevice.ERROR);

        if (failReason != BleStatuses.BOND_SUCCESS)
        {
            m_mngr.getLogger().w(m_mngr.getLogger().gattUnbondReason(failReason));
        }
    }
    else
    {
        failReason = BleStatuses.BOND_FAIL_REASON_NOT_APPLICABLE;
    }

    final P_NativeDeviceLayer layer = m_mngr.m_config.newDeviceLayer(BleDevice.NULL);

    final BluetoothDevice device_native = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

    layer.setNativeDevice(device_native);

    onNativeBondStateChanged(layer, previousState, newState, failReason);
}
 
Example 11
Source File: P_Logger.java    From AsteroidOSSync with GNU General Public License v3.0 5 votes vote down vote up
public void log_status(int gattStatus, String message)
{
	if( !m_enabled )  return;
	
	int level = Utils.isSuccess(gattStatus) ? Log.INFO : Log.WARN;
	message = gattStatus(gattStatus) + " " + message;
	
	log(level, message);
}
 
Example 12
Source File: SonicRuntimeImpl.java    From WanAndroid with MIT License 5 votes vote down vote up
@Override
public void log(String tag, int level, String message) {
    switch (level) {
        case Log.ERROR:
            Log.e(tag, message);
            break;
        case Log.INFO:
            Log.i(tag, message);
            break;
        default:
            Log.d(tag, message);
    }
}
 
Example 13
Source File: DefaultSonicRuntimeImpl.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
public void log(String tag, int level, String message) {
    switch (level) {
        case Log.ERROR:
            Log.e(tag, message);
            break;
        case Log.INFO:
            Log.i(tag, message);
            break;
        default:
            Log.d(tag, message);
    }
}
 
Example 14
Source File: AndroidLogger.java    From sentry-android with MIT License 5 votes vote down vote up
private int toLogcatLevel(SentryLevel sentryLevel) {
  switch (sentryLevel) {
    case INFO:
      return Log.INFO;
    case WARNING:
      return Log.WARN;
    case FATAL:
      return Log.ASSERT;
    case LOG:
    case DEBUG:
    default:
      return Log.DEBUG;
  }
}
 
Example 15
Source File: MyApplication.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
public void initLogger() {
    // Default configuration
    int consoleLogLevel = BuildConfig.DEBUG ? Log.VERBOSE : Log.INFO;
    // File logging based on preferences
    String fileLoggingLevelString = getPreferencesProvider().getFileLoggingLevel();
    if (fileLoggingLevelString.equals(getString(R.string.preferences_file_logging_level_entries_value_disabled))) {
        if (Timber.forest().contains(FileLoggingTree.INSTANCE)) {
            Timber.uproot(FileLoggingTree.INSTANCE);
        }
    } else {
        if (PermissionUtils.hasPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)) {
            int fileLogLevel = Log.ERROR;
            if (fileLoggingLevelString.equals(getString(R.string.preferences_file_logging_level_entries_value_debug))) {
                fileLogLevel = Log.DEBUG;
            } else if (fileLoggingLevelString.equals(getString(R.string.preferences_file_logging_level_entries_value_info))) {
                fileLogLevel = Log.INFO;
            } else if (fileLoggingLevelString.equals(getString(R.string.preferences_file_logging_level_entries_value_warning))) {
                fileLogLevel = Log.WARN;
            } else if (fileLoggingLevelString.equals(getString(R.string.preferences_file_logging_level_entries_value_error))) {
                fileLogLevel = Log.ERROR;
            }
            consoleLogLevel = Math.min(consoleLogLevel, fileLogLevel);
            if (Timber.forest().contains(FileLoggingTree.INSTANCE)) {
                Timber.uproot(FileLoggingTree.INSTANCE);
            }
            Timber.plant(FileLoggingTree.INSTANCE.setPriority(fileLogLevel));
        } else {
            Toast.makeText(this, R.string.permission_logging_denied_temporarily_message, Toast.LENGTH_LONG).show();
        }
    }
    Timber.plant(ConsoleLoggingTree.INSTANCE.setPriority(consoleLogLevel));
}
 
Example 16
Source File: LogLineAdapterUtil.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public static boolean logLevelIsAcceptableGivenLogLevelLimit(int logLevel, int logLevelLimit) {

        int minVal = 0;
        switch (logLevel) {

            case Log.VERBOSE:
                minVal = 0;
                break;
            case Log.DEBUG:
                minVal = 1;
                break;
            case Log.INFO:
                minVal = 2;
                break;
            case Log.WARN:
                minVal = 3;
                break;
            case Log.ERROR:
                minVal = 4;
                break;
            case LOG_WTF:
                minVal = 5;
                break;
            default: // e.g. the starting line that says "output of log such-and-such"
                return true;
        }

        return minVal >= logLevelLimit;

    }
 
Example 17
Source File: DebugTree.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
    // Workaround for devices that doesn't show lower priority logs
    if (Build.MANUFACTURER.equals("HUAWEI") || Build.MANUFACTURER.equals("samsung")) {
        if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO)
            priority = Log.ERROR;
    }
    super.log(priority, tag, message, t);
}
 
Example 18
Source File: L.java    From droidddle with Apache License 2.0 4 votes vote down vote up
private static void log(final int pType, final Throwable t, final Object s1, final Object... args) {
    if (pType == Log.ERROR || BuildConfig.DEBUG) {
        final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[4];

        final String fullClassName = stackTraceElement.getClassName();
        final String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
        final int lineNumber = stackTraceElement.getLineNumber();
        final String method = stackTraceElement.getMethodName();

        final String tag = className + ":" + lineNumber;

        final StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(method);
        stringBuilder.append("(): ");

        if (s1 != null) {
            final String message = (args == null) ? s1.toString() : String.format((String) s1, args);
            stringBuilder.append(message);
        }

        switch (pType) {
            case Log.VERBOSE:
                if (t != null) {
                    Log.v(tag, stringBuilder.toString(), t);
                } else {
                    Log.v(tag, stringBuilder.toString());
                }
                break;

            case Log.DEBUG:
                if (t != null) {
                    Log.d(tag, stringBuilder.toString(), t);
                } else {
                    Log.d(tag, stringBuilder.toString());
                }
                break;

            case Log.INFO:
                if (t != null) {
                    Log.i(tag, stringBuilder.toString(), t);
                } else {
                    Log.i(tag, stringBuilder.toString());
                }
                break;

            case Log.WARN:
                if (t != null) {
                    Log.w(tag, stringBuilder.toString(), t);
                } else {
                    Log.w(tag, stringBuilder.toString());
                }
                break;

            case Log.ERROR:
                if (t != null) {
                    Log.e(tag, stringBuilder.toString(), t);
                } else {
                    Log.e(tag, stringBuilder.toString());
                }
                break;
        }
    }
}
 
Example 19
Source File: VLog.java    From Phantom with Apache License 2.0 4 votes vote down vote up
public static void i(String format, Object... args) {
    if (Log.INFO >= sLevel) {
        Log.i(sTag, buildMsg(String.format(format, args)));
    }
}
 
Example 20
Source File: LogUtil.java    From apollo-DuerOS with Apache License 2.0 4 votes vote down vote up
public static void i(String tag, String format) {
    if (CommonParams.LOG_LEVEL <= Log.INFO) {
        Log.i(tag, format);
    }
}