From 1ad0d850655c13943436f725732bbe7c289957d8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 14 Feb 2021 19:27:28 +0100 Subject: Add 'fprintf_td(FILE* stream, const char * format, ...) noexcept', fprintf(..) + prepending the environment::getElapsedMillisecond() timestamp --- src/debug.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/debug.cpp b/src/debug.cpp index 4cc228e..2db91d0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -185,6 +185,15 @@ void jau::PLAIN_PRINT(const bool printPrefix, const char * format, ...) noexcept fflush(stderr); } +int jau::fprintf_td(FILE* stream, const char * format, ...) noexcept { + int res = ::fprintf(stderr, "[%s] ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str()); + va_list args; + va_start (args, format); + res += ::vfprintf(stream, format, args); + va_end (args); + return res; +} + void jau::COND_PRINT_impl(const char * format, ...) noexcept { fprintf(stderr, "[%s] ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str()); va_list args; -- cgit v1.2.3