summaryrefslogtreecommitdiffstats
path: root/tools/lib/api/debug.c
blob: 69b1ba3d1ee380724bfa02a94f80959a7cad2828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <stdarg.h>
#include "debug.h"
#include "debug-internal.h"

static int __base_pr(const char *format, ...)
{
	va_list args;
	int err;

	va_start(args, format);
	err = vfprintf(stderr, format, args);
	va_end(args);
	return err;
}

libapi_print_fn_t __pr_warning = __base_pr;
libapi_print_fn_t __pr_info    = __base_pr;
libapi_print_fn_t __pr_debug;

void libapi_set_print(libapi_print_fn_t warn,
		      libapi_print_fn_t info,
		      libapi_print_fn_t debug)
{
	__pr_warning = warn;
	__pr_info    = info;
	__pr_debug   = debug;
}
OpenPOWER on IntegriCloud