@@ -26,6 +26,23 @@ extern "C" {
26
26
/* Forward declaration of the log_backend type. */
27
27
struct log_backend ;
28
28
29
+
30
+ /**
31
+ * @brief Backend events
32
+ */
33
+ enum log_backend_evt {
34
+ /** @brief Maximum number of backend events */
35
+ LOG_BACKEND_EVT_MAX ,
36
+ };
37
+
38
+ /**
39
+ * @brief Argument(s) for backend events.
40
+ */
41
+ union log_backend_evt_arg {
42
+ /** @brief Unspecified argument(s). */
43
+ void * raw ;
44
+ };
45
+
29
46
/**
30
47
* @brief Logger backend API.
31
48
*/
@@ -39,6 +56,10 @@ struct log_backend_api {
39
56
int (* is_ready )(const struct log_backend * const backend );
40
57
int (* format_set )(const struct log_backend * const backend ,
41
58
uint32_t log_type );
59
+
60
+ void (* notify )(const struct log_backend * const backend ,
61
+ enum log_backend_evt event ,
62
+ union log_backend_evt_arg * arg );
42
63
};
43
64
44
65
/**
@@ -297,6 +318,24 @@ static inline int log_backend_format_set(const struct log_backend *backend, uint
297
318
return backend -> api -> format_set (backend , log_type );
298
319
}
299
320
321
+ /**
322
+ * @brief Notify a backend of an event.
323
+ *
324
+ * @param backend Pointer to the backend instance.
325
+ * @param event Event to be notified.
326
+ * @param arg Pointer to the argument(s).
327
+ */
328
+ static inline void log_backend_notify (const struct log_backend * const backend ,
329
+ enum log_backend_evt event ,
330
+ union log_backend_evt_arg * arg )
331
+ {
332
+ __ASSERT_NO_MSG (backend != NULL );
333
+
334
+ if (backend -> api -> notify ) {
335
+ backend -> api -> notify (backend , event , arg );
336
+ }
337
+ }
338
+
300
339
/**
301
340
* @}
302
341
*/
0 commit comments