-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow clients to set a log callback.
- Loading branch information
1 parent
716a8b4
commit bfed05d
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
cc::Build::new().file("src/log.c").compile("cubeb_log_wrap"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdarg.h> | ||
#include <stdio.h> | ||
|
||
/** The maximum size of a log message, after having been formatted. */ | ||
#define CUBEB_LOG_MESSAGE_MAX_SIZE 256 | ||
|
||
void rust_write_formatted_msg(char* msg); | ||
|
||
void cubeb_write_log(char const * fmt, ...) { | ||
va_list args; | ||
va_start(args, fmt); | ||
char msg[CUBEB_LOG_MESSAGE_MAX_SIZE]; | ||
vsnprintf(msg, CUBEB_LOG_MESSAGE_MAX_SIZE, fmt, args); | ||
va_end(args); | ||
rust_write_formatted_msg(msg); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters