diff options
author | 2019-10-03 10:22:20 +0300 | |
---|---|---|
committer | 2019-10-03 10:22:20 +0300 | |
commit | 87f165ac89990a89198f256e1794e14d2d07dae3 (patch) | |
tree | c909fb7fc6ff03e69ade2e8ed8b387b8cd4dc9d8 /src/diagnostic/diagnostic.c | |
parent | 14d59d61634035a4f6777e43bf91affa7351a681 (diff) | |
download | librin-87f165ac89990a89198f256e1794e14d2d07dae3.tar.gz librin-87f165ac89990a89198f256e1794e14d2d07dae3.tar.bz2 librin-87f165ac89990a89198f256e1794e14d2d07dae3.zip |
diagnostic: allow setting output stream(s).
Added a function to allow changing a channel's output stream.
This also makes it possible to direct output to a file.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/diagnostic/diagnostic.c')
-rw-r--r-- | src/diagnostic/diagnostic.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/diagnostic/diagnostic.c b/src/diagnostic/diagnostic.c index 9bb4396..58a0292 100644 --- a/src/diagnostic/diagnostic.c +++ b/src/diagnostic/diagnostic.c @@ -45,6 +45,32 @@ int rin_diag_flags(int flag, int action) return 0; } +int rin_diag_set_outstream(enum rin_diag_outstream channel, FILE *stream) +{ + if (!stream) { + return EINVAL; + } + + switch (channel) { + case rin_diag_err: + state.err = stream; + break; + case rin_diag_warn: + state.warn = stream; + break; + case rin_diag_fixme: + state.fixme = stream; + break; + case rin_diag_info: + state.info = stream; + break; + default: + return EINVAL; + } + + return 0; +} + void rin_err(const char *format, ...) { va_list args; |