blob: 2ac4c33fcce30a8bd276b65bf06df854a4ea917c [file] [log] [blame]
Gabor Ambrusa9f8d172023-08-14 22:32:08 +02001/*
2 * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef LOG_BACKEND_H
8#define LOG_BACKEND_H
9
10#include "components/service/log/common/log_status.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/**
17 * \brief Common log backend interface
18 *
19 * A concrete log backend provides an implementation of this
20 * interface.
21 */
22struct log_backend_interface {
23 /**
24 * \brief Processes the character sequence (str) in a desired way (e.g. print to UART).
25 *
26 * \param[in] context The concrete backend context
27 * \param[in] str Character sequence to be printed (null-terminated)
28 */
29 log_status_t (*puts)(void *context, const char *str);
30};
31
32/**
33 * \brief Common log backend instance
34 */
35struct log_backend {
36 /**
37 * \brief The backend context
38 *
39 * Points to backend specific instance data.
40 */
41 void *context;
42
43 /**
44 * \brief The backend interface
45 *
46 * A concrete backend provides an implementation of this interface.
47 */
48 const struct log_backend_interface *interface;
49};
50
51#ifdef __cplusplus
52} /* extern "C" */
53#endif
54
55#endif /* LOG_BACKEND_H */