diff --git a/c/tskit/core.c b/c/tskit/core.c index 0f31550a71..07a85b2eea 100644 --- a/c/tskit/core.c +++ b/c/tskit/core.c @@ -1041,7 +1041,7 @@ FILE * tsk_get_debug_stream(void) { if (_tsk_debug_stream == NULL) { - _tsk_debug_stream = stdout; + _tsk_debug_stream = TSK_DEFAULT_DEBUG_STREAM; } return _tsk_debug_stream; } diff --git a/c/tskit/core.h b/c/tskit/core.h index 481905b7ad..266847c75d 100644 --- a/c/tskit/core.h +++ b/c/tskit/core.h @@ -511,7 +511,7 @@ disallowed (use compute_mutation_times?). */ #define TSK_ERR_DISALLOWED_UNKNOWN_MUTATION_TIME -510 -/** +/** A mutation's parent was not consistent with the topology of the tree. */ #define TSK_ERR_BAD_MUTATION_PARENT -511 @@ -971,6 +971,12 @@ not be freed by client code. */ const char *tsk_strerror(int err); +/* Redefine this macro in downstream builds if stdout is not the + * approriate stream to emit debug information when the TSK_DEBUG + * flag is passed to supporting functions (e.g. in R). + */ +#define TSK_DEFAULT_DEBUG_STREAM stdout + #ifdef TSK_TRACE_ERRORS static inline int