PipeWire  1.2.7
file.h
Go to the documentation of this file.
1 /* Simple Plugin API */
2 /* SPDX-FileCopyrightText: Copyright © 2022 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef SPA_DEBUG_FILE_H
6 #define SPA_DEBUG_FILE_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <stdio.h>
13 #include <stdarg.h>
14 #include <ctype.h>
15 
16 #include <spa/utils/defs.h>
17 #include <spa/support/log.h>
18 #include <spa/debug/context.h>
19 #include <spa/debug/dict.h>
20 #include <spa/debug/format.h>
21 #include <spa/debug/mem.h>
22 #include <spa/debug/pod.h>
23 
29 struct spa_debug_file_ctx {
30  struct spa_debug_context ctx;
31  FILE *f;
32 };
33 
35 static inline void spa_debug_file_log(struct spa_debug_context *ctx, const char *fmt, ...)
36 {
38  va_list args;
39  va_start(args, fmt);
40  vfprintf(c->f, fmt, args); fputc('\n', c->f);
41  va_end(args);
42 }
43 
44 #define SPA_DEBUG_FILE_INIT(_f) \
45  (struct spa_debug_file_ctx){ { spa_debug_file_log }, _f, }
46 
47 #define spa_debug_file_error_location(f,loc,fmt,...) \
48 ({ \
49  struct spa_debug_file_ctx c = SPA_DEBUG_FILE_INIT(f); \
50  if (fmt) spa_debugc(&c.ctx, fmt, __VA_ARGS__); \
51  spa_debugc_error_location(&c.ctx, loc); \
52 })
53 
58 #ifdef __cplusplus
59 } /* extern "C" */
60 #endif
61 
62 #endif /* SPA_DEBUG_FILE_H */
spa/debug/dict.h
spa/debug/format.h
spa/debug/pod.h
spa/utils/defs.h
static void spa_debug_file_log(struct spa_debug_context *ctx, const char *fmt,...)
Definition: file.h:40
#define SPA_CONTAINER_OF(p, t, m)
Definition: defs.h:235
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:295
spa/debug/context.h
spa/debug/mem.h
spa/support/log.h
Definition: context.h:34
Definition: file.h:34
FILE * f
Definition: file.h:36
struct spa_debug_context ctx
Definition: file.h:35