Add command to show errlog buffer contents

This commit is contained in:
Simon Rose authored and Andrew Johnson committed 2026-05-27 09:50:20 -05:00
1 parent a03d1fbe45
commit bb5f12b2fa
4 files changed
+71 -9

No files matched your search

+28
View File
@@ -641,6 +641,34 @@ void errlogBufResize(int bufsize, int maxMsgSize)
epicsMutexUnlock(pvt.bufSizeLock);
}
void errlogShow(int level)
{
epicsMutexMustLock(pvt.bufSizeLock);
printf("Error log:\n");
printf(" buffer size: %zu\n", pvt.bufSize);
printf(" max message size: %zu\n", pvt.maxMsgSize);
epicsMutexUnlock(pvt.bufSizeLock);
if (level > 0)
{
epicsMutexMustLock(pvt.listenerLock);
printf(" number of listeners: %u\n", pvt.listenerList.count);
epicsMutexUnlock(pvt.listenerLock);
}
if (level > 1)
{
epicsMutexMustLock(pvt.msgQueueLock);
printf(" buffer(log) contents:\n");
printf("%s\n", pvt.log->base);
printf("%*s^\n", (int)pvt.log->pos, "");
printf(" buffer(print) contents:\n");
printf("%s\n", pvt.print->base);
printf("%*s^\n", (int)pvt.print->pos, "");
epicsMutexUnlock(pvt.msgQueueLock);
}
}
void errlogFlush(void)
{
/* wait for both buffers to be handled to know that all currently
-9
View File
@@ -224,15 +224,6 @@ LIBCOM_API int errlogInit(int bufsize);
*/
LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize);
/**
* errlogBufResize can be used to reinitialize the error logging system with a larger buffer and maximum message size.
* The default buffer size is 1280 bytes, and the default maximum message size is 256.
*
* \param bufsize The desired buffer size
* \param maxMsgSize The desired max message size
*/
LIBCOM_API void errlogBufResize(int bufsize, int maxMsgSize);
/** Wakes up the errlog task and then waits until all messages are flushed from the queue. */
LIBCOM_API void errlogFlush(void);
+26
View File
@@ -0,0 +1,26 @@
/*************************************************************************\
* Copyright (c) 2026 European Spallation Source ERIC
* SPDX-License-Identifier: EPICS
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef INC_errlogPvt_H
#define INC_errlogPvt_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* errlogShow is used to display the contents of the error log buffers
*
* \param level How much detail to print out
*/
void errlogShow(int level);
#ifdef __cplusplus
}
#endif
#endif /*INC_errlogPvt_H*/