List of usage examples for android.util Log println
public static int println(int priority, String tag, String msg)
From source file:org.fs.core.AbstractPagerAdapter.java
protected final void log(final int lv, final String str) { if (isLogEnabled()) { Log.println(lv, getClassTag(), str); }//from ww w . ja v a2s . co m }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * VERBOSE ?.// ww w . ja v a2 s . co m * * @param clazz ?? Class. * @param msg . */ public static void v(final Class<?> clazz, final String msg) { if (LogUtil.isVerboseEnabled()) { Log.println(Log.VERBOSE, TAG, LogUtil.getClassLineNumber(clazz) + " - " + msg); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.VERBOSE, LogUtil.getClassLineNumber(clazz), msg); } } }
From source file:org.fs.todo.views.adapters.StateToDoAdapter.java
private void log(int lv, String msg) { if (isLogEnabled()) { Log.println(lv, getClassTag(), msg); } }
From source file:com.example.android.common.logger.LogWrapper.java
/** * 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. *//*from www. j av a2 s .c o m*/ @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); } }
From source file:org.thoughtland.xlocation.Util.java
public static void log(XHook hook, int priority, String msg) { // Check if logging enabled int uid = Process.myUid(); if (!mLogDetermined && uid > 0) { mLogDetermined = true;/*from www .j av a 2s . c o m*/ try { mLog = PrivacyManager.getSettingBool(0, PrivacyManager.cSettingLog, false); } catch (Throwable ignored) { mLog = false; } } // Log if enabled if (priority != Log.DEBUG && (priority == Log.INFO ? mLog : true)) if (hook == null) Log.println(priority, "XLocation", msg); else Log.println(priority, String.format("XLocation/%s", hook.getClass().getSimpleName()), msg); // Report to service if (uid > 0 && priority == Log.ERROR) if (PrivacyService.isRegistered()) PrivacyService.reportErrorInternal(msg); else try { IPrivacyService client = PrivacyService.getClient(); if (client != null) client.reportError(msg); } catch (RemoteException ignored) { } }
From source file:es.uva.tel.gte.cardiomanager.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.slide_main); // Comprobamos la alarma que nos indica si se ha cerrado o no la aplicacin DBAdapter dbAdapter = new DBAdapter(getApplicationContext()); dbAdapter.open();// w w w .jav a 2 s. c o m boolean alarmUp = isMyServiceRunning(AppService.class); if (alarmUp) { // No se ha cerrado la aplicacin Log.println(Log.ASSERT, "Main Activity", "La alarma estaba activa"); } else { Log.println(Log.ASSERT, "Main Activity", "Activamos alarma"); // Se ha cerrado la aplicacion // Volvemos a poner la alarma Intent intent = new Intent(getApplicationContext(), CheckAlarmsService.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 123456789, intent, PendingIntent.FLAG_UPDATE_CURRENT); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.YEAR, 1); // Alarma a 1 ao, tiempo suficiente Log.println(Log.ASSERT, "Alarm Created", "Alarm Created"); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 1000 * 60, pendingIntent); // Comprobamos ahora cuantos medicamentos no se han tomado startService(intent); } // Instantiate a ViewPager and a PagerAdapter. mPager = (ViewPager) findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); fManager = getSupportFragmentManager(); Cursor cursor = dbAdapter.fetchAllRows(DBAdapter.TABLE_NAME_POLITICS_ACCEPTED); if (cursor.moveToFirst()) { if (cursor.getInt(1) == 1 && cursor.getInt(2) == 1) { // Accepted } else { // Mostrar dilogo PoliticDialog newFragment = new PoliticDialog(); newFragment.show(fManager, "Tag"); } } else { // Mostrar dilogo PoliticDialog newFragment = new PoliticDialog(); newFragment.show(fManager, "Tag"); } dbAdapter.close(); }
From source file:biz.bokhorst.xprivacy.Util.java
public static void log(XHook hook, int priority, String msg) { // Check if logging enabled int uid = Process.myUid(); if (!mLogDetermined && uid > 0) { mLogDetermined = true;//from w w w . j a va 2s .c o m try { mLog = PrivacyManager.getSettingBool(0, PrivacyManager.cSettingLog, false); } catch (Throwable ignored) { mLog = false; } } // Log if enabled if (priority != Log.DEBUG && (priority == Log.INFO ? mLog : true)) if (hook == null) Log.println(priority, "XPrivacy", msg); else Log.println(priority, String.format("XPrivacy/%s", hook.getClass().getSimpleName()), msg); // Report to service if (uid > 0 && priority == Log.ERROR) if (PrivacyService.isRegistered()) PrivacyService.reportErrorInternal(msg); else try { IPrivacyService client = PrivacyService.getClient(); if (client != null) client.reportError(msg); } catch (RemoteException ignored) { } }
From source file:com.andresrcb.gcmtest.LoggingService.java
private void doLog(Intent intent) { int priority = intent.getIntExtra(EXTRA_LOG_PRIORITY, Log.INFO); String msg = intent.getStringExtra(EXTRA_LOG_MESSAGE); // Make the log available through adb logcat Log.println(priority, LOG_TAG, msg); // Add the timestamp to the message String timestamp = dateFormat.format(new Date()); msg = timestamp + " " + msg; // Forward the log to LocalBroadcast subscribers (i.e. UI) Intent localIntent = new Intent(ACTION_LOG); localIntent.putExtra(EXTRA_LOG_MESSAGE, msg); LocalBroadcastManager.getInstance(this).sendBroadcast(localIntent); // Write log to file try {//from ww w . jav a2 s .com FileOutputStream outputFile = openFileOutput(LOG_FILE, MODE_APPEND); outputFile.write(msg.getBytes()); outputFile.write(LOG_SEPARATOR.getBytes()); outputFile.close(); } catch (IOException ex) { Log.e(LOG_TAG, "Error while writing in the log file", ex); } }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * VERBOSE ?.// ww w .j av a 2 s . c o m * * @param clazz ?? Class. * @param tr Throwable. */ public static void v(final Class<?> clazz, final Throwable tr) { if (LogUtil.isVerboseEnabled()) { Log.println(Log.VERBOSE, TAG, LogUtil.getClassLineNumber(clazz) + " - " + Log.getStackTraceString(tr)); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.VERBOSE, LogUtil.getClassLineNumber(clazz), tr); } } }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * VERBOSE ?./*from www .j a v a2s. c om*/ * * @param clazz ?? Class. * @param msg . * @param tr Throwable. */ public static void v(final Class<?> clazz, final String msg, final Throwable tr) { if (LogUtil.isVerboseEnabled()) { Log.println(Log.VERBOSE, TAG, LogUtil.getClassLineNumber(clazz) + " - " + msg + '\n' + Log.getStackTraceString(tr)); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.VERBOSE, LogUtil.getClassLineNumber(clazz), msg, tr); } } }