Skip to Content
Pro Android Apps Performance Optimization
book

Pro Android Apps Performance Optimization

by Hervé Guihot
January 2012
Intermediate to advanced
282 pages
7h 4m
English
Apress
Content preview from Pro Android Apps Performance Optimization

Logging

As we have seen in many listings already, you can use the Log class to print out messages to LogCat. In addition to the Java traditional logging mechanism such as System.out.println(), Android defines six log levels, each having its own methods:

  • verbose (Log.v)
  • debug (Log.d)
  • info (Log.i)
  • warning (Log.w)
  • error (Log.e)
  • assert (Log.wtf)

For example, a call to Log.v(TAG, “my message”) is equivalent to a call to Log.println(Log.VERBOSE, TAG, “my message”).

NOTE: The Log.wtf() methods were introduced in API level 8, but Log.ASSERT exists since API level 1. If you want to use the ASSERT log level but want to guarantee compatibility with older Android devices, use Log.println(Log.ASSERT, …) instead of Log.wtf(…).

You can then use LogCat in ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Android High Performance Programming

Android High Performance Programming

Enrique López Mañas, Diego Grancini
Pro Android Graphics

Pro Android Graphics

Wallace Jackson

Publisher Resources

ISBN: 9781430239994Purchase book