Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ab9d062
Init version of caput JSON logger
Jul 28, 2020
6a30b46
Switch from defines to enums
Jul 31, 2020
3a4dba3
Json ca put log doxygen
Jul 31, 2020
95b67bc
Merge branch 'jsonCaPutLogDoxygen' into 'master'
Jul 31, 2020
9a8aee1
Define JSON_AND_ARRAYS_SUPPORTED macro in Makefile
Aug 3, 2020
d8659d5
Switch from std atomic to epicsAtomic
Aug 3, 2020
b5a8e86
Handle better how array size is determinated
Aug 3, 2020
deac703
Handle arrays better
Aug 3, 2020
47a5a12
Add share attribute to new class/functions
Aug 3, 2020
f4683af
Correctly handle new line at the end of the log
Aug 4, 2020
901b4be
Handle Nan and +/- infinity properly
Aug 4, 2020
cc1eb3a
Add ability to costumize queue size via variable
Aug 4, 2020
c4fd437
Check if server was specified
Aug 6, 2020
ed30167
Remove some c++11 features
Aug 10, 2020
53579a7
Replace nullptr with NULL as some targets may still not support it
Aug 10, 2020
feda03a
Init version of json docs
Aug 5, 2020
44f4118
Allow to use rset (disable deprecated warrnings)
Aug 12, 2020
221ec65
Simplify check for special values
Aug 12, 2020
f97885f
Handle lso/lsi records correctly
Aug 12, 2020
6d8ef15
Add a note that lso/lsi record require .$ or will be tranucated at 40…
Aug 12, 2020
d341cff
Change date/time format to specifications
Aug 17, 2020
b2b8702
Update time format
Aug 17, 2020
8a63d8d
Add unit tests for Json logger
Aug 17, 2020
a562b27
Merge branch 'jsonCaPutLogTests' into 'master'
Aug 17, 2020
20cd2dd
Include recSup.h for successful build against base R3.15
Aug 18, 2020
6b38a25
Cleanup uneeded includes
Aug 18, 2020
b1c1403
Cleanup library includes
Aug 18, 2020
fe60530
Add message why test is waiting
Aug 18, 2020
c9153ac
Remove all c++11 features
Aug 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ include $(TOP)/configure/CONFIG

DIRS := configure
DIRS += caPutLogApp
DIRS += test

caPutLogApp_DEPEND_DIRS = configure
test_DEPEND_DIRS = caPutLogApp

# Allow 'make docs' but don't otherwise descend into it
ifeq ($(MAKECMDGOALS),docs)
Expand Down
13 changes: 13 additions & 0 deletions caPutLogApp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include $(TOP)/configure/CONFIG

LIBRARY_IOC = caPutLog

USR_CPPFLAGS += -DUSE_TYPED_RSET

caPutLog_SRCS += caPutLogTask.c
caPutLog_SRCS += caPutLogAs.c
caPutLog_SRCS += caPutLogClient.c
Expand All @@ -21,6 +23,17 @@ INC += caPutLogAs.h

DBD += caPutLog.dbd

# Add support for json format and arrays
# This requires EPICS base version 7.0.1 or higher
ifdef BASE_7_0
USR_CPPFLAGS += -DJSON_AND_ARRAYS_SUPPORTED
caPutLog_SRCS += caPutJsonLogTask.cpp
caPutLog_SRCS += caPutJsonLogShellCommands.cpp
INC += caPutJsonLogTask.h
DBD += caPutJsonLog.dbd
endif


caPutLog_LIBS += $(EPICS_BASE_IOC_LIBS)
caPutLog_SYS_LIBS_WIN32 += ws2_32

Expand Down
2 changes: 2 additions & 0 deletions caPutLogApp/caPutJsonLog.dbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variable(caPutLogJsonMsgQueueSize,int)
registrar(caPutJsonLogRegister)
94 changes: 94 additions & 0 deletions caPutLogApp/caPutJsonLogShellCommands.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* File: caPutJsonLogShellCommands.cpp
* Author: Matic Pogacnik
* Created: 21.07.2020
*
* Contains code for a IOC shell configuration commands of the
* JSON CA put logger implementation.
*
* Modification log:
* ----------------
* v 1.0
* - Initial version
*/

#include <errlog.h>
#include <iocsh.h>
#include <epicsExport.h>

#include "caPutJsonLogTask.h"

/* EPICS iocsh shell commands */
extern "C"
{
extern int caPutLogJsonMsgQueueSize;

/* Initalisation */
int caPutJsonLogInit(const char * address, caPutJsonLogConfig config){
CaPutJsonLogTask *logger = CaPutJsonLogTask::getInstance();
if (logger != NULL) return logger->initialize(address, config);
else return -1;
}

static const iocshArg caPutJsonLogInitArg0 = {"address", iocshArgString};
static const iocshArg caPutJsonLogInitArg1 = {"config", iocshArgInt};
static const iocshArg *const caPutJsonLogInitArgs[] = {
&caPutJsonLogInitArg0,
&caPutJsonLogInitArg1
};
static const iocshFuncDef caPutjsonLogInitDef = {"caPutJsonLogInit", 2, caPutJsonLogInitArgs};
static void caPutJsonLogInitCall(const iocshArgBuf *args)
{
caPutJsonLogInit(args[0].sval, static_cast<caPutJsonLogConfig>(args[1].ival));
}


/* Reconfigure */
int caPutJsonLogReconf(caPutJsonLogConfig config){
CaPutJsonLogTask *logger = CaPutJsonLogTask::getInstance();
if (logger != NULL) return logger->reconfigure(config);
else return -1;
}

static const iocshArg caPutJsonLogReconfArg0 = {"config", iocshArgInt};
static const iocshArg *const caPutJsonLogReconfArgs[] = {
&caPutJsonLogReconfArg0
};
static const iocshFuncDef caPutJsonLogReconfDef = {"caPutJsonLogReconf", 1, caPutJsonLogReconfArgs};
static void caPutJsonLogReconfCall(const iocshArgBuf *args)
{
caPutJsonLogReconf(static_cast<caPutJsonLogConfig>(args[0].ival));
}

/* Report */
int caPutJsonLogShow(int level){
CaPutJsonLogTask *logger = CaPutJsonLogTask::getInstance();
if (logger != NULL) return logger->report(level);
else return -1;
}

static const iocshArg caPutJsonLogShowArg0 = {"level", iocshArgInt};
static const iocshArg *const caPutJsonLogShowArgs[] = {
&caPutJsonLogShowArg0
};
static const iocshFuncDef caPutJsonLogShowDef = {"caPutJsonLogShow", 1, caPutJsonLogShowArgs};
static void caPutJsonLogShowCall(const iocshArgBuf *args)
{
caPutJsonLogShow(args[0].ival);
}


/* Register IOCsh commands */
static void caPutJsonLogRegister(void)
{
static int done = FALSE;
if(done) return;
done = TRUE;

iocshRegister(&caPutjsonLogInitDef,caPutJsonLogInitCall);
iocshRegister(&caPutJsonLogReconfDef,caPutJsonLogReconfCall);
iocshRegister(&caPutJsonLogShowDef,caPutJsonLogShowCall);
}
epicsExportRegistrar(caPutJsonLogRegister);

epicsExportAddress(int,caPutLogJsonMsgQueueSize);
}
Loading