|
PebbleOS v4.44.0-79-gafcb109f5
|
Outputs of log messages. More...
Data Structures | |
| struct | pbl_log_msg |
| Log message. More... | |
| struct | pbl_log_backend_api |
| Backend operations. More... | |
| struct | pbl_log_backend_state |
| Runtime state of a backend. More... | |
| struct | pbl_log_backend |
| Backend. More... | |
Macros | |
| #define | PBL_LOG_MSG_ASYNC (1U << 0) |
| The message may be written after pbl_log_backend_api::process returns. | |
| #define | PBL_LOG_MSG_FAULT (1U << 1) |
| The message comes from a fault handler, where OS services are unavailable. | |
| #define | PBL_LOG_BACKEND_DEFINE(_name, _api, _level, _autostart) |
| Define a backend. | |
| #define | PBL_LOG_BACKEND_GET(_name) |
| Get a backend defined with PBL_LOG_BACKEND_DEFINE. | |
Functions | |
| void | pbl_log_backend_enable (const struct pbl_log_backend *backend) |
Start passing messages to backend. | |
| void | pbl_log_backend_disable (const struct pbl_log_backend *backend) |
Stop passing messages to backend. | |
| bool | pbl_log_backend_is_enabled (const struct pbl_log_backend *backend) |
Whether messages are passed to backend. | |
| void | pbl_log_backend_set_level (const struct pbl_log_backend *backend, int level) |
Set the highest LOG_LEVEL_* level written by backend. | |
| const struct pbl_log_backend * | pbl_log_backend_get_by_name (const char *name) |
| Find a backend by name. | |
| void | pbl_log_init (void) |
| Initialize the backends. | |
| void | pbl_log_panic (void) |
| Have every backend write out its pending messages, the system is about to stop. | |
Outputs of log messages.
A backend is defined with PBL_LOG_BACKEND_DEFINE and receives every message at or below its level through pbl_log_backend_api::process, in the context of the caller. The logging core only knows backends through this interface.
| struct pbl_log_msg |
Log message.
| Data Fields | ||
|---|---|---|
| const uint8_t * | app_uuid | UUID of the app that logged the message, or NULL for system messages. |
| const char * | file | Source file name. |
| uint8_t | flags | PBL_LOG_MSG_* flags. |
| uint8_t | level | LOG_LEVEL_* level. |
| uint16_t | line | Source line number. |
| const char * | text | Message text, NUL-terminated. |
| uint8_t | text_len | Length of text in the binary log message format. |
| uint32_t | timestamp | Time the message was logged at, in seconds, or 0 if unknown. |
| struct pbl_log_backend_state |
| struct pbl_log_backend |
Backend.
| Data Fields | ||
|---|---|---|
| const struct pbl_log_backend_api * | api | Operations. |
| const char * | name | Name. |
| struct pbl_log_backend_state * | state | Runtime state. |
| #define PBL_LOG_BACKEND_DEFINE | ( | _name, | |
| _api, | |||
| _level, | |||
| _autostart | |||
| ) |
Define a backend.
| _name | Backend name, also its identifier. |
| _api | Backend operations. |
| _level | Initial highest LOG_LEVEL_* level written. |
| _autostart | Whether the backend starts enabled, or waits for pbl_log_backend_enable. |
| #define PBL_LOG_BACKEND_GET | ( | _name | ) |
Get a backend defined with PBL_LOG_BACKEND_DEFINE.
| _name | Backend name. |
| #define PBL_LOG_MSG_ASYNC (1U << 0) |
The message may be written after pbl_log_backend_api::process returns.
| #define PBL_LOG_MSG_FAULT (1U << 1) |
The message comes from a fault handler, where OS services are unavailable.
| void pbl_log_backend_disable | ( | const struct pbl_log_backend * | backend | ) |
Stop passing messages to backend.
| void pbl_log_backend_enable | ( | const struct pbl_log_backend * | backend | ) |
Start passing messages to backend.
| const struct pbl_log_backend * pbl_log_backend_get_by_name | ( | const char * | name | ) |
Find a backend by name.
name. | bool pbl_log_backend_is_enabled | ( | const struct pbl_log_backend * | backend | ) |
Whether messages are passed to backend.
| void pbl_log_backend_set_level | ( | const struct pbl_log_backend * | backend, |
| int | level | ||
| ) |
Set the highest LOG_LEVEL_* level written by backend.
| void pbl_log_init | ( | void | ) |
Initialize the backends.
| void pbl_log_panic | ( | void | ) |
Have every backend write out its pending messages, the system is about to stop.