diff --git a/src/StreamEpics.cc b/src/StreamEpics.cc index d1e8ca8..7be2a73 100644 --- a/src/StreamEpics.cc +++ b/src/StreamEpics.cc @@ -200,6 +200,7 @@ epicsExportAddress(int, streamDebug); epicsExportAddress(int, streamError); epicsExportAddress(int, streamDebugColored); epicsExportAddress(int, streamErrorDeadTime); +epicsExportAddress(int, streamMsgTimeStamped); } // for subroutine record diff --git a/src/StreamError.cc b/src/StreamError.cc index 53087fb..2b898b6 100644 --- a/src/StreamError.cc +++ b/src/StreamError.cc @@ -35,6 +35,9 @@ int streamDebug = 0; int streamError = 1; FILE *StreamDebugFile = NULL; +/*0: disable timestamps on stream messages (both debug and error)*/ +int streamMsgTimeStamped = 1; + #ifndef va_copy #ifdef __va_copy #define va_copy __va_copy @@ -115,7 +118,11 @@ void StreamVError(int line, const char* file, const char* fmt, va_list args) { char timestamp[40]; if (!(streamError || streamDebug)) return; // Error logging disabled - StreamPrintTimestampFunction(timestamp, 40); + strcpy(timestamp, ""); + if (streamMsgTimeStamped != 0) + { + StreamPrintTimestampFunction(timestamp, 40); + } #ifdef va_copy if (StreamDebugFile) { @@ -146,7 +153,10 @@ print(const char* fmt, ...) const char* f = strrchr(file, '/'); if (f) f++; else f = file; FILE* fp = StreamDebugFile ? StreamDebugFile : stderr; - fprintf(fp, "%s ", timestamp); + if (streamMsgTimeStamped != 0) + { + fprintf(fp, "%s ", timestamp); + } fprintf(fp, "%s:%d: ", f, line); vfprintf(fp, fmt, args); fflush(fp); diff --git a/src/StreamError.h b/src/StreamError.h index 2ec8183..1f4d544 100644 --- a/src/StreamError.h +++ b/src/StreamError.h @@ -33,6 +33,7 @@ extern int streamDebug; extern int streamError; extern int streamDebugColored; +extern int streamMsgTimeStamped; extern void (*StreamPrintTimestampFunction)(char* buffer, size_t size); void StreamError(int line, const char* file, const char* fmt, ...) diff --git a/src/makedbd.pl b/src/makedbd.pl index c480525..0323245 100644 --- a/src/makedbd.pl +++ b/src/makedbd.pl @@ -34,6 +34,7 @@ if (@ARGV[0] eq "-3.13") { print "variable(streamError, int)\n"; print "variable(streamDebugColored, int)\n"; print "variable(streamErrorDeadTime, int)\n"; + print "variable(streamMsgTimeStamped, int)\n"; print "registrar(streamRegistrar)\n"; if ($asyn) { print "registrar(AsynDriverInterfaceRegistrar)\n"; } }