Skip to content

Commit aeb1bde

Browse files
authored
Merge pull request #891 from opensourcerouting/api_tracing
Introduce API tracing for debug logging
2 parents 63fb3ea + c777742 commit aeb1bde

File tree

12 files changed

+306
-0
lines changed

12 files changed

+306
-0
lines changed

src/common.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ THREAD_LOCAL int8_t ly_errno_glob;
3636
API LY_ERR *
3737
ly_errno_glob_address(void)
3838
{
39+
FUN_IN;
40+
3941
return (LY_ERR *)&ly_errno_glob;
4042
}
4143

4244
API LY_VECODE
4345
ly_vecode(const struct ly_ctx *ctx)
4446
{
47+
FUN_IN;
48+
4549
struct ly_err_item *i;
4650

4751
i = ly_err_first(ctx);
@@ -55,6 +59,8 @@ ly_vecode(const struct ly_ctx *ctx)
5559
API const char *
5660
ly_errmsg(const struct ly_ctx *ctx)
5761
{
62+
FUN_IN;
63+
5864
struct ly_err_item *i;
5965

6066
i = ly_err_first(ctx);
@@ -68,6 +74,8 @@ ly_errmsg(const struct ly_ctx *ctx)
6874
API const char *
6975
ly_errpath(const struct ly_ctx *ctx)
7076
{
77+
FUN_IN;
78+
7179
struct ly_err_item *i;
7280

7381
i = ly_err_first(ctx);
@@ -81,6 +89,8 @@ ly_errpath(const struct ly_ctx *ctx)
8189
API const char *
8290
ly_errapptag(const struct ly_ctx *ctx)
8391
{
92+
FUN_IN;
93+
8494
struct ly_err_item *i;
8595

8696
i = ly_err_first(ctx);
@@ -94,6 +104,8 @@ ly_errapptag(const struct ly_ctx *ctx)
94104
API struct ly_err_item *
95105
ly_err_first(const struct ly_ctx *ctx)
96106
{
107+
FUN_IN;
108+
97109
if (!ctx) {
98110
return NULL;
99111
}
@@ -119,6 +131,8 @@ ly_err_free(void *ptr)
119131
API void
120132
ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
121133
{
134+
FUN_IN;
135+
122136
struct ly_err_item *i, *first;
123137

124138
first = ly_err_first(ctx);
@@ -601,6 +615,8 @@ transform_xml2json(struct ly_ctx *ctx, const char *expr, struct lyxml_elem *xml,
601615
API char *
602616
ly_path_xml2json(struct ly_ctx *ctx, const char *xml_path, struct lyxml_elem *xml)
603617
{
618+
FUN_IN;
619+
604620
const char *json_path;
605621
char *ret = NULL;
606622

@@ -1190,6 +1206,8 @@ ly_path_data2schema_subexp(const struct ly_ctx *ctx, const struct lys_node *orig
11901206
API char *
11911207
ly_path_data2schema(struct ly_ctx *ctx, const char *data_path)
11921208
{
1209+
FUN_IN;
1210+
11931211
struct lyxp_expr *exp;
11941212
uint16_t out_used, cur_exp = 0;
11951213
char *out;

src/common.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ void ly_log_dbg(int group, const char *format, ...);
127127

128128
#endif
129129

130+
#define FUN_IN LOGDBG(LY_LDGAPI, "%s", __func__);
131+
130132
#define LOGMEM(ctx) LOGERR(ctx, LY_EMEM, "Memory allocation failed (%s()).", __func__)
131133

132134
#define LOGINT(ctx) LOGERR(ctx, LY_EINT, "Internal error (%s:%d).", __FILE__, __LINE__)

0 commit comments

Comments
 (0)