Logging

#include <log.h>

Summary

Enumerations

android_LogPriority{
  ANDROID_LOG_UNKNOWN = 0,
  ANDROID_LOG_DEFAULT,
  ANDROID_LOG_VERBOSE,
  ANDROID_LOG_DEBUG,
  ANDROID_LOG_INFO,
  ANDROID_LOG_WARN,
  ANDROID_LOG_ERROR,
  ANDROID_LOG_FATAL,
  ANDROID_LOG_SILENT
}
enum
Android log priority values, in increasing order of priority.
log_id{
  LOG_ID_MIN = 0,
  LOG_ID_MAIN = 0,
  LOG_ID_RADIO = 1,
  LOG_ID_EVENTS = 2,
  LOG_ID_SYSTEM = 3,
  LOG_ID_CRASH = 4,
  LOG_ID_STATS = 5,
  LOG_ID_SECURITY = 6,
  LOG_ID_KERNEL = 7,
  LOG_ID_MAX
}
enum

Typedefs

android_LogPriority typedef
Android log priority values, in increasing order of priority.
log_id_t typedef
enum log_id

Functions

__android_log_assert(const char *cond, const char *tag, const char *fmt, ...)
void
Writes an assertion failure to the log (as ANDROID_LOG_FATAL) and to stderr, before calling abort(3).
__android_log_buf_print(int bufID, int prio, const char *tag, const char *fmt, ...)
int
__android_log_buf_write(int bufID, int prio, const char *tag, const char *text)
int
__android_log_print(int prio, const char *tag, const char *fmt, ...)
int
Writes a formatted string to the log, with priority prio and tag tag.
__android_log_vprint(int prio, const char *tag, const char *fmt, va_list ap)
int
Equivalent to __android_log_print, but taking a va_list.
__android_log_write(int prio, const char *tag, const char *text)
int
Writes the constant string text to the log, with priority prio and tag tag.

Enumerations

android_LogPriority

 android_LogPriority

Android log priority values, in increasing order of priority.

Properties
ANDROID_LOG_DEBUG

Debug logging.

Should typically be disabled for a release apk.

ANDROID_LOG_DEFAULT

The default priority, for internal use only.

ANDROID_LOG_ERROR

Error logging.

For use with unrecoverable failures.

ANDROID_LOG_FATAL

Fatal logging.

For use when aborting.

ANDROID_LOG_INFO

Informational logging.

Should typically be disabled for a release apk.

ANDROID_LOG_SILENT

For internal use only.

ANDROID_LOG_UNKNOWN

For internal use only.

ANDROID_LOG_VERBOSE

Verbose logging.

Should typically be disabled for a release apk.

ANDROID_LOG_WARN

Warning logging.

For use with recoverable failures.

Typedefs

android_LogPriority

enum android_LogPriority android_LogPriority

Android log priority values, in increasing order of priority.

log_id_t

enum log_id log_id_t

Functions

__android_log_assert

void __android_log_assert(
  const char *cond,
  const char *tag,
  const char *fmt,
  ...
)

Writes an assertion failure to the log (as ANDROID_LOG_FATAL) and to stderr, before calling abort(3).

If fmt is non-null, cond is unused. If fmt is null, the string Assertion failed: s is used with cond as the string argument. If both fmt and cond are null, a default string is provided.

Most callers should use assert(3) from instead, or the __assert and __assert2 functions provided by bionic if more control is needed. They support automatically including the source filename and line number more conveniently than this function.

__android_log_buf_print

int __android_log_buf_print(
  int bufID,
  int prio,
  const char *tag,
  const char *fmt,
  ...
)

__android_log_buf_write

int __android_log_buf_write(
  int bufID,
  int prio,
  const char *tag,
  const char *text
)

__android_log_print

int __android_log_print(
  int prio,
  const char *tag,
  const char *fmt,
  ...
)

Writes a formatted string to the log, with priority prio and tag tag.

The details of formatting are the same as for printf(3).

__android_log_vprint

int __android_log_vprint(
  int prio,
  const char *tag,
  const char *fmt,
  va_list ap
)

Equivalent to __android_log_print, but taking a va_list.

(If __android_log_print is like printf, this is like vprintf.)

__android_log_write

int __android_log_write(
  int prio,
  const char *tag,
  const char *text
)

Writes the constant string text to the log, with priority prio and tag tag.