# Logging

## Summary

| ### Enumerations ||
|---|---|
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gafb8ac810cc71f3ad8cdccae79f4cc6b6{ https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a6927fcfc48b12aa4c2495182c1a77abc = 0, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a78eac1c0035b045de012f3a42660c1e0, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a0adbaa5c45010323cfffffa93234578c, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a3357428f473998c530d5de9519a74d45, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6ad46329103f1e9bf318b889f331d1ea8b, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a14a2da1996b5063456ac916077f2597e, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6af1067b5ff6e64a6ece3249c113d2d164, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a28ceb8fa306acd280b7b891214ec2de2, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggafb8ac810cc71f3ad8cdccae79f4cc6b6a8daee540c7d1fc04a9dfecc2db988f3b }` | enumAndroid log priority values, in increasing order of priority. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gabcd142e91968af61158b3d0b72eb72df{ https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfac608cc0ca81c9e8dfd9adfc27b409ff6 = 0, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfaec4d00613b6ed282851bf7af5ca24e33 = 0, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfaf9aeff779d764540561d77956b25c3ba = 1, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfacd5725799c73357bfcd03fcf0993b13b = 2, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfa389cc2d9456c0ef43a72aaa2cc5938ec = 3, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfac63284457f764086d438b422f84d0eb1 = 4, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfae083210d5d623edbb8ebd114b3009e0c = 5, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfa1b0fe3048aa5dd32f0d74b236b851b77 = 6, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfac58cb4586d90499950714ea1ad01635c = 7, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfa484e3e8f1ad11f0e45a3a11379a8c80d, https://developer.android.com/ndk/reference/group/logging#group___logging_1ggabcd142e91968af61158b3d0b72eb72dfa4580089137123d65d1c23201d16c9ddb = 0x7FFFFFFF }` | enumIdentifies a specific log buffer for [__android_log_buf_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a) and [__android_log_buf_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2). |

| ### Typedefs ||
|---|---|
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gaf052fc10540e0cc7c01bf30ebaab8ab0)(const char *abort_message)` | typedef `void(*` Prototype for the 'abort' function that is called when liblog will abort due to [__android_log_assert()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga612e57971e51fb6d3760ee7c1ae34049) failures. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga62460a026a58ced2424f8fdb7c51f5f6)(const struct __android_log_message *log_message)` | typedef `void(*` Prototype for the 'logger' function that is called for every log message. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga73e497bb346e9243cbb55a8e2423c712` | typedef `enum https://developer.android.com/ndk/reference/group/logging#group___logging_1gafb8ac810cc71f3ad8cdccae79f4cc6b6` Android log priority values, in increasing order of priority. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gafd05c78987a8d0a4e79c2a6a89951f8b` | typedef `enum https://developer.android.com/ndk/reference/group/logging#group___logging_1gabcd142e91968af61158b3d0b72eb72df` Identifies a specific log buffer for [__android_log_buf_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a) and [__android_log_buf_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2). |

| ### Functions ||
|---|---|
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga612e57971e51fb6d3760ee7c1ae34049(const char *cond, const char *tag, const char *fmt, ...)` | `void` Writes an assertion failure to the main log buffer with priority `ANDROID_LOG_FATAL` and also to stderr before calling [abort(3)](http://man7.org/linux/man-pages/man3/abort.3.html). |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2(int log_id, int prio, const char *tag, const char *fmt, ...)` | `int` Writes a formatted string to the log buffer `log_id` (one of the `log_id_t` values), with priority `prio` (one of the `android_LogPriority` values) and tag `tag`. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a(int log_id, int prio, const char *tag, const char *text)` | `int` Writes the string `text` to the log buffer `log_id` (one of the `log_id_t` values), with priority `prio` (one of the `android_LogPriority` values) and tag `tag`. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga2b269de071259402e5e935783bd39cdf(const char *abort_message)` | `void` Calls the stored aborter function. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gacc7027f299db4b270b79112f444a83c0(const char *abort_message)` | `void` Sets [android_set_abort_message()](https://developer.android.com/ndk/reference/set/abort-message-8h#set__abort__message_8h_1ac483b2fcb74191566f18476ce3280c9c) on device then aborts(). |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga080d7d4820d9770f8148d177e6aacfc4(void)` | `int32_t` Gets the minimum priority that will be logged for this process. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga561c3995126ffc4f530102a6244d53aa(https://developer.android.com/ndk/reference/group/logging#group___logging_1gafd05c78987a8d0a4e79c2a6a89951f8b log_id)` | `bool` |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4(int prio, const char *tag, int default_prio)` | `int` Use the per-tag properties "log.tag." along with the minimum priority from [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912) to determine if a log message with a given prio and tag will be printed. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gac1692b35d0ebe853710ad8adfae74b2d(int prio, const char *tag, size_t len, int default_prio)` | `int` Use the per-tag properties "log.tag." along with the minimum priority from [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912) to determine if a log message with a given prio and tag will be printed. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga3b64dc97cbf6553ea47c663f4876570c(const struct https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message *log_message)` | `void` Writes the log message to logd. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga91b6c7e893504c26fd2fe01b3e5b54b7(const struct https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message *log_message, const struct timespec *timestamp)` | `void` Writes the log message to logd using the passed in timestamp. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gac60e52c9711c53803ad9af639083afd5(int prio, const char *tag, const char *fmt, ...)` | `int` Writes a formatted string to the main log buffer, with priority `prio` (one of the `android_LogPriority` values) and tag `tag`. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gaaf4a089f7950ba27678ce62a07f0eb36(https://developer.android.com/ndk/reference/group/logging#group___logging_1gaf052fc10540e0cc7c01bf30ebaab8ab0 aborter)` | `void` Sets a user defined aborter function that is called for [__android_log_assert()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga612e57971e51fb6d3760ee7c1ae34049) failures. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga73670d336ba2a6677da5cab7f987f5fe(const char *tag)` | `void` Sets the default tag if no tag is provided when writing a log message. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga0e29961fa7bd5904bfc142d795af1fd6(https://developer.android.com/ndk/reference/group/logging#group___logging_1ga62460a026a58ced2424f8fdb7c51f5f6 logger)` | `void` Sets a user defined logger function. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912(int32_t priority)` | `int32_t` Sets the minimum priority that will be logged for this process. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga57124f64e3b75eaf824197319033f5be(const struct https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message *log_message)` | `void` Writes the log message to stderr. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gad494481eb4e3dec072fa99e281e30c7c(int prio, const char *tag, const char *fmt, va_list ap)` | `int` Equivalent to [__android_log_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gac60e52c9711c53803ad9af639083afd5), but taking a `va_list`. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1ga32a7173b092ec978b50490bd12ee523b(int prio, const char *tag, const char *text)` | `int` Writes the constant string `text` to the main log buffer, with priority `prio` (one of the `android_LogPriority` values) and tag `tag`. |
| `https://developer.android.com/ndk/reference/group/logging#group___logging_1gae1b17ba6f4b629164bfaebb312f127e8(struct https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message *log_message)` | `void` Writes the log message specified by log_message. |

| ### Structs ||
|---|---|
| [__android_log_message](https://developer.android.com/ndk/reference/struct/android-log-message) | Logger data struct used for writing log messages to liblog via __android_log_write_logger_data() and sending log messages to user defined loggers specified in [__android_log_set_logger()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga0e29961fa7bd5904bfc142d795af1fd6). |

## Enumerations

### android_LogPriority

Declared in `android/log.h`

```scdoc
 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. |

### log_id

Declared in `android/log.h`

```scdoc
 log_id
```
Identifies a specific log buffer for [__android_log_buf_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a) and [__android_log_buf_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2).

| Properties ||
|---|---|
| `LOG_ID_CRASH` | The crash log buffer. |
| `LOG_ID_DEFAULT` | Let the logging library choose the best log target in cases where it's unclear. This is useful if you're generic library code that can't know which log your caller should use. |
| `LOG_ID_EVENTS` | The event log buffer. |
| `LOG_ID_KERNEL` | The kernel log buffer. |
| `LOG_ID_MAIN` | The main log buffer. This is the only log buffer available to apps. |
| `LOG_ID_MAX` | For internal use only. |
| `LOG_ID_MIN` | For internal use only. |
| `LOG_ID_RADIO` | The radio log buffer. |
| `LOG_ID_SECURITY` | The security log buffer. |
| `LOG_ID_STATS` | The statistics log buffer. |
| `LOG_ID_SYSTEM` | The system log buffer. |

## Typedefs

### __android_aborter_function

Declared in `android/log.h`

```gdscript
void(* __android_aborter_function)(const char *abort_message)
```
Prototype for the 'abort' function that is called when liblog will abort due to [__android_log_assert()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga612e57971e51fb6d3760ee7c1ae34049) failures.

### __android_logger_function

Declared in `android/log.h`

```gdscript
void(* __android_logger_function)(const struct __android_log_message *log_message)
```
Prototype for the 'logger' function that is called for every log message.

### android_LogPriority

Declared in `android/log.h`

```gdscript
enum android_LogPriority android_LogPriority
```
Android log priority values, in increasing order of priority.

### log_id_t

Declared in `android/log.h`

```gdscript
enum log_id log_id_t
```
Identifies a specific log buffer for [__android_log_buf_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a) and [__android_log_buf_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2).

## Functions

### __android_log_assert

Declared in `android/log.h`

```gdscript
void __android_log_assert(
  const char *cond,
  const char *tag,
  const char *fmt,
  ...
)
```
Writes an assertion failure to the main log buffer with priority `ANDROID_LOG_FATAL` and also to stderr before calling [abort(3)](http://man7.org/linux/man-pages/man3/abort.3.html).

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)](http://man7.org/linux/man-pages/man3/assert.3.html) 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

Declared in `android/log.h`

```gdscript
int __android_log_buf_print(
  int log_id,
  int prio,
  const char *tag,
  const char *fmt,
  ...
)
```
Writes a formatted string to the log buffer `log_id` (one of the `log_id_t` values), with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.

The details of formatting are the same as for [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).

Apps should use [__android_log_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gac60e52c9711c53803ad9af639083afd5) instead because LOG_ID_MAIN is the only log buffer available to them.

<br />

| Details ||
|---|---|
| **Returns** | 1 if the message was written to the log, or -EPERM if it was not; see [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). |

### __android_log_buf_write

Declared in `android/log.h`

```gdscript
int __android_log_buf_write(
  int log_id,
  int prio,
  const char *tag,
  const char *text
)
```
Writes the string `text` to the log buffer `log_id` (one of the `log_id_t` values), with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.

Apps should use [__android_log_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga32a7173b092ec978b50490bd12ee523b) instead because LOG_ID_MAIN is the only log buffer available to them.

<br />

| Details ||
|---|---|
| **Returns** | 1 if the message was written to the log, or -EPERM if it was not; see [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). |

### __android_log_call_aborter

Declared in `android/log.h`

```gdscript
void __android_log_call_aborter(
  const char *abort_message
)
```
Calls the stored aborter function.

This allows for other logging libraries to use the same aborter function by calling this function in liblog.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `abort_message` | an additional message supplied when aborting, for example this is used to call [android_set_abort_message()](https://developer.android.com/ndk/reference/set/abort-message-8h#set__abort__message_8h_1ac483b2fcb74191566f18476ce3280c9c) in [__android_log_default_aborter()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gacc7027f299db4b270b79112f444a83c0). | |

### __android_log_default_aborter

Declared in `android/log.h`

```gdscript
void __android_log_default_aborter(
  const char *abort_message
)
```
Sets [android_set_abort_message()](https://developer.android.com/ndk/reference/set/abort-message-8h#set__abort__message_8h_1ac483b2fcb74191566f18476ce3280c9c) on device then aborts().

This is the default aborter.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `abort_message` | an additional message supplied when aborting. This functions calls [android_set_abort_message()](https://developer.android.com/ndk/reference/set/abort-message-8h#set__abort__message_8h_1ac483b2fcb74191566f18476ce3280c9c) with its contents. | |

### __android_log_get_minimum_priority

Declared in `android/log.h`

```scdoc
int32_t __android_log_get_minimum_priority(
  void
)
```
Gets the minimum priority that will be logged for this process.


Available since API level 30.

| Details ||
|---|---|
| **Returns** | the current minimum priority, or `ANDROID_LOG_DEFAULT` if none is set. |

### __android_log_id_is_valid

Declared in `android/log.h`

```scdoc
bool __android_log_id_is_valid(
  log_id_t log_id
)
```

### __android_log_is_loggable

Declared in `android/log.h`

```gdscript
int __android_log_is_loggable(
  int prio,
  const char *tag,
  int default_prio
)
```
Use the per-tag properties "log.tag." along with the minimum priority from [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912) to determine if a log message with a given prio and tag will be printed.

A non-zero result indicates yes, zero indicates false.

If both a priority for a tag and a minimum priority are set by [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912), then the lowest of the two values are to determine the minimum priority needed to log. If only one is set, then that value is used to determine the minimum priority needed. If none are set, then default_priority is used.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `prio` | the priority to test, takes [android_LogPriority](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga73e497bb346e9243cbb55a8e2423c712) values. | | `tag` | the tag to test. | | `default_prio` | the default priority to use if no properties or minimum priority are set. | |
| **Returns** | an integer where 1 indicates that the message is loggable and 0 indicates that it is not. |

### __android_log_is_loggable_len

Declared in `android/log.h`

```gdscript
int __android_log_is_loggable_len(
  int prio,
  const char *tag,
  size_t len,
  int default_prio
)
```
Use the per-tag properties "log.tag." along with the minimum priority from [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912) to determine if a log message with a given prio and tag will be printed.

A non-zero result indicates yes, zero indicates false.

If both a priority for a tag and a minimum priority are set by [__android_log_set_minimum_priority()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gad487c002fa1cd610f3b01de1719ff912), then the lowest of the two values are to determine the minimum priority needed to log. If only one is set, then that value is used to determine the minimum priority needed. If none are set, then default_priority is used.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `prio` | the priority to test, takes [android_LogPriority](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga73e497bb346e9243cbb55a8e2423c712) values. | | `tag` | the tag to test. | | `len` | the length of the tag. | | `default_prio` | the default priority to use if no properties or minimum priority are set. | |
| **Returns** | an integer where 1 indicates that the message is loggable and 0 indicates that it is not. |

### __android_log_logd_logger

Declared in `android/log.h`

```gdscript
void __android_log_logd_logger(
  const struct __android_log_message *log_message
)
```
Writes the log message to logd.

This is an [__android_logger_function](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga62460a026a58ced2424f8fdb7c51f5f6) and can be provided to [__android_log_set_logger()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga0e29961fa7bd5904bfc142d795af1fd6). It is the default logger when running liblog on a device.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `log_message` | the log message to write, see [__android_log_message](https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message). | |

### __android_log_logd_logger_with_timestamp

Declared in `android/log.h`

```gdscript
void __android_log_logd_logger_with_timestamp(
  const struct __android_log_message *log_message,
  const struct timespec *timestamp
)
```
Writes the log message to logd using the passed in timestamp.

The messages are stored in logd in the order received not in order by timestamp. When displaying the log, there is no guarantee that messages are in timestamp order and might cause messages with different times to be interleaved. Filtering the log using a timestamp will work properly even if out of time order messages are present.


Available since API level 37.

| Details ||
|---|---|
| Parameters | |---|---| | `log_message` | the log message to write, see [__android_log_message](https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message). | | `timestamp` | the time to use for this log message. The value is interpreted as a CLOCK_REALTIME value. | |

### __android_log_print

Declared in `android/log.h`

```gdscript
int __android_log_print(
  int prio,
  const char *tag,
  const char *fmt,
  ...
)
```
Writes a formatted string to the main log buffer, with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.

The details of formatting are the same as for [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).

See [__android_log_buf_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gab0d88dbee8a5de5150f42d7ec5e642d2) to write to a different log buffer.

<br />

| Details ||
|---|---|
| **Returns** | 1 if the message was written to the log, or -EPERM if it was not; see [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). |

### __android_log_set_aborter

Declared in `android/log.h`

```scdoc
void __android_log_set_aborter(
  __android_aborter_function aborter
)
```
Sets a user defined aborter function that is called for [__android_log_assert()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga612e57971e51fb6d3760ee7c1ae34049) failures.

This user defined aborter function is highly recommended to abort and be noreturn, but is not strictly required to.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `aborter` | the new aborter function, see [__android_aborter_function](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaf052fc10540e0cc7c01bf30ebaab8ab0). | |

### __android_log_set_default_tag

Declared in `android/log.h`

```gdscript
void __android_log_set_default_tag(
  const char *tag
)
```
Sets the default tag if no tag is provided when writing a log message.

Defaults to getprogname(). This truncates tag to the maximum log message size, though appropriate tags should be much smaller.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `tag` | the new log tag. | |

### __android_log_set_logger

Declared in `android/log.h`

```scdoc
void __android_log_set_logger(
  __android_logger_function logger
)
```
Sets a user defined logger function.

All log messages sent to liblog will be set to the function pointer specified by logger for processing. It is not expected that log messages are already terminated with a new line. This function should add new lines if required for line separation.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `logger` | the new function that will handle log messages. | |

### __android_log_set_minimum_priority

Declared in `android/log.h`

```scdoc
int32_t __android_log_set_minimum_priority(
  int32_t priority
)
```
Sets the minimum priority that will be logged for this process.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `priority` | the new minimum priority to set, takes [android_LogPriority](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga73e497bb346e9243cbb55a8e2423c712) values. | |
| **Returns** | the previous set minimum priority, or `ANDROID_LOG_DEFAULT` if none was set. |

### __android_log_stderr_logger

Declared in `android/log.h`

```gdscript
void __android_log_stderr_logger(
  const struct __android_log_message *log_message
)
```
Writes the log message to stderr.

This is an [__android_logger_function](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga62460a026a58ced2424f8fdb7c51f5f6) and can be provided to [__android_log_set_logger()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga0e29961fa7bd5904bfc142d795af1fd6). It is the default logger when running liblog on host.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `log_message` | the log message to write, see [__android_log_message](https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message). | |

### __android_log_vprint

Declared in `android/log.h`

```gdscript
int __android_log_vprint(
  int prio,
  const char *tag,
  const char *fmt,
  va_list ap
)
```
Equivalent to [__android_log_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gac60e52c9711c53803ad9af639083afd5), but taking a `va_list`.

(If [__android_log_print()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gac60e52c9711c53803ad9af639083afd5) is like printf(), this is like vprintf().)

<br />

| Details ||
|---|---|
| **Returns** | 1 if the message was written to the log, or -EPERM if it was not; see [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). |

### __android_log_write

Declared in `android/log.h`

```gdscript
int __android_log_write(
  int prio,
  const char *tag,
  const char *text
)
```
Writes the constant string `text` to the main log buffer, with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.

See [__android_log_buf_write()](https://developer.android.com/ndk/reference/group/logging#group___logging_1ga5227f3b3a691cbe753a25b9b5810842a) to write to a different log buffer.

<br />

| Details ||
|---|---|
| **Returns** | 1 if the message was written to the log, or -EPERM if it was not; see [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). |

### __android_log_write_log_message

Declared in `android/log.h`

```scdoc
void __android_log_write_log_message(
  struct __android_log_message *log_message
)
```
Writes the log message specified by log_message.

log_message includes additional file name and line number information that a logger may use. log_message is versioned for backwards compatibility. This assumes that loggability has already been checked through [__android_log_is_loggable()](https://developer.android.com/ndk/reference/group/logging#group___logging_1gaa1e86114313b6046c894389e694b8bd4). Higher level logging libraries, such as libbase, first check loggability, then format their buffers, then pass the message to liblog via this function, and therefore we do not want to duplicate the loggability check here.


Available since API level 30.

| Details ||
|---|---|
| Parameters | |---|---| | `log_message` | the log message itself, see [__android_log_message](https://developer.android.com/ndk/reference/struct/android-log-message#struct____android__log__message). | |