platform_system_core/liblog
Mark Salyzyn 2d3f38a6b8 liblog: introduce ANDROID_LOG_* flags
Move away from using POSIX open(2) flags and introduce ANDROID_LOG_* flags to
replace them. Add security by preventing random mode flags from getting into
underlying POSIX calls. ANDROID_LOG_* flags overlap POSIX O_* flag definitions.

Change-Id: Ib32bb64c287e8bf150be62242e1ba46bb37839fc
2015-02-25 17:44:18 +00:00
..
tests liblog: introduce ANDROID_LOG_* flags 2015-02-25 17:44:18 +00:00
Android.mk liblog: add __android_log_is_loggable() 2015-02-09 22:12:59 +00:00
event_tag_map.c liblog: set -Werror 2014-05-07 16:56:21 -07:00
fake_log_device.c liblog: add __android_log_is_loggable() 2015-02-09 22:12:59 +00:00
fake_log_device.h Fixes some warnings 2014-01-28 11:28:32 -08:00
log_is_loggable.c liblog: add __android_log_is_loggable() 2015-02-09 22:12:59 +00:00
log_read.c liblog: introduce ANDROID_LOG_* flags 2015-02-25 17:44:18 +00:00
log_read_kern.c liblog: introduce ANDROID_LOG_* flags 2015-02-25 17:44:18 +00:00
log_time.cpp liblog: Add log_time += operator 2015-01-05 16:27:54 +00:00
logd_write.c liblog: test: ARM64: Enable 32 and 64-bit liblog_benchmark 2015-02-10 18:15:51 +00:00
logd_write_kern.c Kill HAVE_PTHREADS. 2015-01-27 14:23:22 -08:00
logprint.c liblog: logcat color output corrupted on 32-bit 2015-01-22 10:00:04 -08:00
NOTICE liblog: update timestamp on NOTICE file 2014-01-27 15:20:59 -08:00
README liblog: introduce ANDROID_LOG_* flags 2015-02-25 17:44:18 +00:00
uio.c Only Windows doesn't have <sys/uio.h>. 2014-11-25 13:27:43 -08:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

LIBLOG(3)               Android NDK Programming Manual               LIBLOG(3)



NAME
       liblog - Android NDK logger interfaces

SYNOPSIS
       #include <log/log.h>

       ALOG(android_priority, tag, format, ...)
       IF_ALOG(android_priority, tag)
       LOG_PRI(priority, tag, format, ...)
       LOG_PRI_VA(priority, tag, format, args)
       #define LOG_TAG NULL
       ALOGV(format, ...)
       SLOGV(format, ...)
       RLOGV(format, ...)
       ALOGV_IF(cond, format, ...)
       SLOGV_IF(cond, format, ...)
       RLOGV_IF(cond, format, ...)
       IF_ALOGC()
       ALOGD(format, ...)
       SLOGD(format, ...)
       RLOGD(format, ...)
       ALOGD_IF(cond, format, ...)
       SLOGD_IF(cond, format, ...)
       RLOGD_IF(cond, format, ...)
       IF_ALOGD()
       ALOGI(format, ...)
       SLOGI(format, ...)
       RLOGI(format, ...)
       ALOGI_IF(cond, format, ...)
       SLOGI_IF(cond, format, ...)
       RLOGI_IF(cond, format, ...)
       IF_ALOGI()
       ALOGW(format, ...)
       SLOGW(format, ...)
       RLOGW(format, ...)
       ALOGW_IF(cond, format, ...)
       SLOGW_IF(cond, format, ...)
       RLOGW_IF(cond, format, ...)
       IF_ALOGW()
       ALOGE(format, ...)
       SLOGE(format, ...)
       RLOGE(format, ...)
       ALOGE_IF(cond, format, ...)
       SLOGE_IF(cond, format, ...)
       RLOGE_IF(cond, format, ...)
       IF_ALOGE()
       LOG_FATAL(format, ...)
       LOG_ALWAYS_FATAL(format, ...)
       LOG_FATAL_IF(cond, format, ...)
       LOG_ALWAYS_FATAL_IF(cond, format, ...)
       ALOG_ASSERT(cond, format, ...)
       LOG_EVENT_INT(tag, value)
       LOG_EVENT_LONG(tag, value)

       Link with -llog

       #include <log/logger.h>

       log_id_t android_logger_get_id(struct logger *logger)
       int android_logger_clear(struct logger *logger)
       int android_logger_get_log_size(struct logger *logger)
       int android_logger_get_log_readable_size(struct logger *logger)
       int android_logger_get_log_version(struct logger *logger)

       struct  logger_list  *android_logger_list_alloc(int  mode, unsigned int
       tail, pid_t pid)
       struct  logger  *android_logger_open(struct  logger_list  *logger_list,
       log_id_t id)
       struct  logger_list  *android_logger_list_open(log_id_t  id,  int mode,
       unsigned int tail, pid_t pid)

       int android_logger_list_read(struct  logger_list  *logger_list,  struct
       log_msg *log_msg

       void android_logger_list_free(struct logger_list *logger_list)

       log_id_t android_name_to_log_id(const char *logName)
       const char *android_log_id_to_name(log_id_t log_id)

       Link with -llog

DESCRIPTION
       liblog  represents  an interface to the volatile Android Logging system
       for NDK (Native) applications  and  libraries.  Interfaces  for  either
       writing  or reading logs.  The log buffers are divided up in Main, Sys
       tem, Radio and Events sub-logs.

       The logging interfaces are a series of macros,  all  of  which  can  be
       overridden individually in order to control the verbosity of the appli
       cation or library.  [ASR]LOG[VDIWE] calls are used  to  log  to  BAsic,
       System or Radio sub-logs in either the Verbose, Debug, Info, Warning or
       Error priorities.  [ASR]LOG[VDIWE]_IF calls are used  to  perform  thus
       based  on a condition being true.  IF_ALOG[VDIWE] calls are true if the
       current LOG_TAG is enabled at the specified priority.  LOG_ALWAYS_FATAL
       is  used to ALOG a message, then kill the process.  LOG_FATAL call is a
       variant of LOG_ALWAYS_FATAL,  only  enabled  in  engineering,  and  not
       release builds.  ALOG_ASSERT is used to ALOG a message if the condition
       is  false;   the   condition   is   part   of   the   logged   message.
       LOG_EVENT_(INT|LONG)  is  used  to  drop binary content into the Events
       sub-log.

       The log reading interfaces permit opening the  logs  either  singly  or
       multiply,  retrieving  a  log  entry  at  a  time in time sorted order,
       optionally limited to a specific pid and tail of the log(s) and finally
       a  call closing the logs.  A single log can be opened with android_log
       ger_list_open;  or  multiple  logs  can  be  opened  with  android_log
       ger_list_alloc,  calling  in  turn the android_logger_open for each log
       id.  Each entry can be retrieved  with  android_logger_list_read.   The
       log(s) can be closed with android_logger_list_free.  The logs should be
       opened  with an  ANDROID_LOG_RDONLY  mode.   ANDROID_LOG_NONBLOCK  mode
       will report when the  log reading is done with an  EAGAIN  error return
       code,  otherwise the  android_logger_list_read  call will block for new
       entries.

       The value returned by android_logger_open can be used as a parameter to
       the  android_logger_clear  function to empty the sub-log.  It is recom
       mended to only open log ANDROID_LOG_WRONLY in that case.

       The value returned by android_logger_open can be used as a parameter to
       the android_logger_get_log_(size|readable_size|version) to retrieve the
       sub-log maximum size, readable size and log buffer format protocol ver
       sion  respectively.  android_logger_get_id returns the id that was used
       when  opening  the  sub-log.    It  is  recommended  to  open  the  log
       ANDROID_LOG_RDONLY in these cases.

SEE ALSO
       syslogd(8)



                                  17 Dec 2013                        LIBLOG(3)