Example usage for android.util Log DEBUG

List of usage examples for android.util Log DEBUG

Introduction

In this page you can find the example usage for android.util Log DEBUG.

Prototype

int DEBUG

To view the source code for android.util Log DEBUG.

Click Source Link

Document

Priority constant for the println method; use Log.d.

Usage

From source file:com.variable.demo.api.fragment.ClimaFragment.java

@Override
public void onClimaHumidityUpdate(ClimaSensor clima, SensorReading<Float> humidityLevel) {
    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_CLIMA_HUMIDITY);
    m.getData().putFloat(MessageConstants.FLOAT_VALUE_KEY, humidityLevel.getValue());
    // convert the UTF
    final Context thiscontext = this.getActivity();
    final DecimalFormat formatter = new DecimalFormat("0.00");
    final String serialnumOne = clima.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scann = formatter.format(humidityLevel.getValue());
    String json = "humidity;" + serialnum + ";" + scann;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(//from   w  w  w .  j  a  v  a2  s  .  c  om
            "https://datadipity.com/clickslide/fleetplusdata.json?PHPSESSID=gae519f8k5humje0jqb195nob6&update&postparam[payload]="
                    + json)
            .setLogging("MyLogs", Log.DEBUG).asString().withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (e == null) {
                        Log.i(TAG, "ION SENT MESSAGE WITH RESULT CODE: " + result.toString());
                    } else {
                        Log.i(TAG, "ION SENT MESSAGE WITH EXCEPTION");
                        e.printStackTrace();
                    }
                }
            });
    m.sendToTarget();
}

From source file:com.example.android.elizachat.ResponderService.java

private void processIncoming(String text) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Received: " + text);
    }//from  w w w . j a  v a2s. com
    mLastResponse = mResponder.elzTalk(text);
    String line = TextUtils.isEmpty(text) ? mLastResponse : text + "\n" + mLastResponse;

    // Send a new line of conversation to update the Activity, unless the incoming text was
    // empty.
    if (!TextUtils.isEmpty(text)) {
        broadcastMessage(line);
    }
    NotificationManagerCompat.from(this).cancelAll();
    showNotification();
    mCompleteConversation.append("\n" + line);
}

From source file:com.android.car.trust.CarBleTrustAgent.java

@Override
public void onTrustTimeout() {
    super.onTrustTimeout();
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onTrustTimeout(): timeout expired");
    }//from w w  w.  j a v  a 2s  .  c  o m
}

From source file:com.ntsync.android.sync.client.MySSLSocketFactory.java

private void verifyHostname(SSLSocket socket) throws SSLPeerUnverifiedException {
    SSLSession session = socket.getSession();
    String hostname = session.getPeerHost();

    X509Certificate[] certs = session.getPeerCertificateChain();
    if (certs == null || certs.length == 0) {
        throw new SSLPeerUnverifiedException("No server certificates found!");
    }//  w w w.j a v a2  s .  c  o  m

    // get the servers DN in its string representation
    String dn = certs[0].getSubjectDN().getName();

    // might be useful to print out all certificates we receive from the
    // server, in case one has to debug a problem with the installed certs.
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Server certificate chain:");
        for (int i = 0; i < certs.length; i++) {
            Log.d(TAG, "X509Certificate[" + i + "]=" + certs[i]);
        }
    }
    // get the common name from the first cert
    String cn = getCN(dn);
    if (hostname != null && hostname.equalsIgnoreCase(cn)) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Target hostname valid: " + cn);
        }
    } else {
        if (BuildConfig.DEBUG) {
            Log.w(TAG, "HTTPS hostname invalid: expected '" + hostname + "', received '" + cn + "'");
            return;
        }
        throw new SSLPeerUnverifiedException(
                "HTTPS hostname invalid: expected '" + hostname + "', received '" + cn + "'");
    }
}

From source file:com.variable.demo.api.fragment.ChromaFragment.java

/**
 * invokes/*from  www.ja  v a 2s. co  m*/
 *
 *    onRGBUpdate
 *    onTimeStampUpdate
 *    onColorUpdate
 *    onLABUpdate
 *
 *
 *
 * @param chromaDevice
 * @param reading
 */
@Override
public void onChromaReadingReceived(ChromaDevice chromaDevice, VTRGBCReading reading) {
    ColorSense sense = reading.getColorSense();
    Log.d(TAG, "SENSE_VALUES: " + sense.getSenseRed().floatValue() + " , " + sense.getSenseGreen() + " , "
            + sense.getSenseBlue() + " , " + sense.getSenseClear());
    int color = ColorUtils.RGBToColor(reading.getD65srgbR(), reading.getD65srgbG(), reading.getD65srgbB());

    //D50 onLABUpdate(reading.getD50L(), reading.getD50a(), reading.getD50b());
    onLABUpdate(reading.getD65L(), reading.getD65a(), reading.getD65b());
    onHexValue("#" + Integer.toHexString(color).substring(2).toUpperCase());
    final Context thiscontext = this.getActivity();
    final String serialnumOne = chromaDevice.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scann = "#" + Integer.toHexString(color).substring(2).toUpperCase();
    String json = "color;" + serialnum + ";" + scann;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(
            "https://datadipity.com/clickslide/fleetplusdata.json?PHPSESSID=gae519f8k5humje0jqb195nob6&update&postparam[payload]="
                    + json)
            .setLogging("MyLogs", Log.DEBUG).asString().withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (e == null) {
                        Log.i(TAG, "ION SENT MESSAGE WITH RESULT CODE: " + result.toString());
                    } else {
                        Log.i(TAG, "ION SENT MESSAGE WITH EXCEPTION");
                        e.printStackTrace();
                    }
                }
            });
    onRGBUpdate(Color.red(color), Color.green(color), Color.blue(color));
    onColorUpdate(color);

}

From source file:com.github.sryze.wirebug.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(
                getString(R.string.app_name),
                BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
                ContextCompat.getColor(this, R.color.colorTaskDescription));
        setTaskDescription(taskDescription);
    }//  w w  w  .  j  a va 2 s  . co m

    toggleDebuggingButton = (ToggleButton) findViewById(R.id.switch_enable_debugging);
    connectedView = findViewById(R.id.view_connected);
    instructionsView = findViewById(R.id.view_instructions);
    connectCommandTextView = (TextView) findViewById(R.id.text_connect_command);
    wifiNetworkTextView = (TextView) findViewById(R.id.text_wifi_network);
    notConnectedView = findViewById(R.id.view_not_connected);

    enableSwitchChangeListener = new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            DebugManager.setTcpDebuggingEnabled(isChecked);
            boolean isActuallyEnabled = DebugManager.isTcpDebuggingEnabled();
            if (isChecked == isActuallyEnabled) {
                updateInstructions(isChecked);
                updateStatus();
            } else {
                Log.i(TAG, String.format("Could NOT %s debugging", isChecked ? "enable" : "disable"));
                String toastText = isChecked ? getString(R.string.could_not_enable)
                        : getString(R.string.could_not_disable);
                Toast.makeText(MainActivity.this, toastText, Toast.LENGTH_SHORT).show();
                toggleDebuggingButton.setChecked(isActuallyEnabled);
            }
        }
    };

    Shell.getShell().setLoggingEnabled(true);
    Shell.getShell().setLogPriority(Log.DEBUG);

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
}

From source file:com.psiphon3.psiphonlibrary.StatusList.java

/**
 * @return Returns the last non-DEBUG, non-WARN(ing) item, or null if there is none.
 *//*from   ww w .ja va  2 s.c  om*/
public static StatusEntry getLastStatusEntryForDisplay() {
    synchronized (m_statusHistory) {
        ListIterator<StatusEntry> iterator = m_statusHistory.listIterator(m_statusHistory.size());

        while (iterator.hasPrevious()) {
            StatusEntry current_item = iterator.previous();
            if (current_item.priority() != Log.DEBUG && current_item.priority() != Log.WARN) {
                return current_item;
            }
        }

        return null;
    }
}

From source file:com.ibm.commerce.worklight.android.search.SearchSuggestionsProvider.java

/**
 * Performs the search by projections and selection arguments
 * @param uri The URI to be used//from   w  w w  .ja v  a 2s  . c o  m
 * @param projection The string array for the search
 * @param selection The selection string
 * @param selectionArgs The selection arguments
 * @param sortOrder The sort order
 * @return The cursor containing the suggestions
 */
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    final String METHOD_NAME = CLASS_NAME + ".query()";
    boolean loggingEnabled = Log.isLoggable(LOG_TAG, Log.DEBUG);
    if (loggingEnabled) {
        Log.d(METHOD_NAME, "ENTRY");
    }

    int id = 1;
    MatrixCursor suggestionCursor = new MatrixCursor(COLUMNS);
    Cursor recentSearchCursor = null;

    try {
        recentSearchCursor = super.query(uri, projection, selection, selectionArgs, sortOrder);
        // get search history
        if (recentSearchCursor != null) {
            int searchTermIndex = recentSearchCursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
            while (recentSearchCursor.moveToNext() && id <= MAX_RECENT_TERM) {
                suggestionCursor.addRow(createRecentRow(id, recentSearchCursor.getString(searchTermIndex)));
                id++;
            }
        }
    } finally {
        if (recentSearchCursor != null) {
            recentSearchCursor.close();
            recentSearchCursor = null;
        }
    }

    // get search suggestion
    if (selectionArgs[0] != null && !selectionArgs[0].equals("")) {
        List<String> suggestionList = getSearchTermSuggestions(selectionArgs[0]);
        if (suggestionList != null) {
            for (String aSuggestion : suggestionList) {
                suggestionCursor.addRow(createSuggestionRow(id, aSuggestion));
                id++;
            }
        }
    }

    if (loggingEnabled) {
        Log.d(METHOD_NAME, "EXIT");
    }

    return suggestionCursor;
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * DEBUG  ?.//  w  w  w.ja v  a2  s. c  om
 * 
 * @param clazz  ??  Class.
 * @param tr Throwable.
 */
public static void d(final Class<?> clazz, final Throwable tr) {
    if (LogUtil.isDebugEnabled()) {
        Log.println(Log.DEBUG, TAG, LogUtil.getClassLineNumber(clazz) + " - " + Log.getStackTraceString(tr));

        //  ?? ?   ?.
        if (LogUtil.isFileLogEnabled()) {
            write(Log.DEBUG, LogUtil.getClassLineNumber(clazz), tr);
        }
    }
}

From source file:com.android.car.trust.CarBleTrustAgent.java

@Override
public void onCreate() {
    super.onCreate();

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Bluetooth trust agent starting up");
    }/*from   w  ww  .  j  av a2  s.  c o  m*/
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_REVOKE_TRUST);
    filter.addAction(ACTION_ADD_TOKEN);
    filter.addAction(ACTION_IS_TOKEN_ACTIVE);
    filter.addAction(ACTION_REMOVE_TOKEN);

    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this /* context */);
    mLocalBroadcastManager.registerReceiver(mTrustEventReceiver, filter);

    // If the user is already unlocked, don't bother starting the BLE service.
    UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
    if (!um.isUserUnlocked()) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "User locked, will now bind CarUnlockService");
        }
        Intent intent = new Intent(this, CarUnlockService.class);

        bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
    } else {
        setManagingTrust(true);
    }
}