blob: 7708f0558e8c302e899685cf4ec4d3c972129fad [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Jiri Olsa975f14f2016-02-14 17:03:42 +01002#include <stdio.h>
3#include <stdarg.h>
4#include "debug.h"
5#include "debug-internal.h"
6
7static int __base_pr(const char *format, ...)
8{
9 va_list args;
10 int err;
11
12 va_start(args, format);
13 err = vfprintf(stderr, format, args);
14 va_end(args);
15 return err;
16}
17
Kefeng Wangc405c372019-10-18 11:18:47 +080018libapi_print_fn_t __pr_warn = __base_pr;
Jiri Olsa975f14f2016-02-14 17:03:42 +010019libapi_print_fn_t __pr_info = __base_pr;
20libapi_print_fn_t __pr_debug;
21
22void libapi_set_print(libapi_print_fn_t warn,
23 libapi_print_fn_t info,
24 libapi_print_fn_t debug)
25{
Kefeng Wangc405c372019-10-18 11:18:47 +080026 __pr_warn = warn;
Jiri Olsa975f14f2016-02-14 17:03:42 +010027 __pr_info = info;
28 __pr_debug = debug;
29}