flt.utils.muxer: add IWYU pragma
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_error.i.h
CommitLineData
5038e256 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
5038e256
SM
3 *
4 * Copyright (c) 2019 Efficios, Inc.
5038e256
SM
5 */
6
ae2be88d
SM
7#ifndef BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_ERROR_I_H
8#define BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_ERROR_I_H
9
5038e256
SM
10#include <string-format/format-error.h>
11
12static
13PyObject *bt_bt2_format_bt_error_cause(const bt_error_cause *error_cause)
14{
15 gchar *error_cause_str;
16 PyObject *py_error_cause_str = NULL;
17
18 error_cause_str = format_bt_error_cause(error_cause, 80,
71436ae4
SM
19 (bt_logging_level) bt_python_bindings_bt2_log_level,
20 BT_COMMON_COLOR_WHEN_NEVER);
5038e256
SM
21 BT_ASSERT(error_cause_str);
22
23 py_error_cause_str = PyString_FromString(error_cause_str);
24
25 g_free(error_cause_str);
26
27 return py_error_cause_str;
28}
29
30static
31PyObject *bt_bt2_format_bt_error(const bt_error *error)
32{
33 gchar *error_str;
34 PyObject *py_error_str = NULL;
35
36 error_str = format_bt_error(error, 80,
71436ae4
SM
37 (bt_logging_level) bt_python_bindings_bt2_log_level,
38 BT_COMMON_COLOR_WHEN_NEVER);
5038e256
SM
39 BT_ASSERT(error_str);
40
41 py_error_str = PyString_FromString(error_str);
42
43 g_free(error_str);
44
45 return py_error_str;
46}
ae2be88d
SM
47
48#endif /* BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_ERROR_I_H */
This page took 0.05721 seconds and 5 git commands to generate.