-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement log_set_stream to allow changing where errors are streamed
- Loading branch information
1 parent
8f2066b
commit 3e33a35
Showing
5 changed files
with
57 additions
and
24 deletions.
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
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,18 @@ | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include "log.h" | ||
|
||
FILE *log_error_stream = NULL; | ||
bool log_error_stream_set = false; | ||
|
||
void log_set_stream (FILE *stream) { | ||
log_error_stream = stream; | ||
log_error_stream_set = true; | ||
} | ||
|
||
FILE *log_get_stream() { | ||
if ( log_error_stream_set ) { | ||
return log_error_stream; | ||
} | ||
return stderr; | ||
} |
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
3e33a35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if a setter and getter is the best solution but it seemed quick and robust