should I just use pipewire's logging?
This commit is contained in:
parent
19403f79ab
commit
b86ad339d9
2 changed files with 27 additions and 0 deletions
22
lib/log.c
Normal file
22
lib/log.c
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
static FILE *LOG_TARGET;
|
||||||
|
|
||||||
|
/* Set file pointer Dorne should log to. */
|
||||||
|
void drn_log_target(FILE *target) {
|
||||||
|
LOG_TARGET = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Log to a specific file descriptor (internal method) */
|
||||||
|
static void drn_log_to(FILE *target, const char *msg) {
|
||||||
|
fprintf(target, "%s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dorne's standard logging interface.
|
||||||
|
* WARNING: ensure drn_log_target(...) has been set!
|
||||||
|
*/
|
||||||
|
void drn_log(const char *msg) {
|
||||||
|
drn_log_to(LOG_TARGET, msg);
|
||||||
|
}
|
||||||
|
|
||||||
5
lib/log.h
Normal file
5
lib/log.h
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void drn_log_target(FILE *target);
|
||||||
|
void drn_log(const char *msg);
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue