32 #ifndef _CL_LOG_API_H_
33 #define _CL_LOG_API_H_
39 #include <sys/types.h>
74 #define CL_LOG_STREAM_NAME_MAX_LENGTH 128
78 #define CL_LOG_SLINE_MSG_LEN 256
181 #define CL_LOG_STREAM_CREATE 0x1
243 #define CL_LOG_HANDLER_WILL_ACK 0x1
308 #define CL_LOG_SEV_EMERGENCY 0x1
312 #define CL_LOG_SEV_ALERT 0x2
316 #define CL_LOG_SEV_CRITICAL 0x3
320 #define CL_LOG_SEV_ERROR 0x4
324 #define CL_LOG_SEV_WARNING 0x5
328 #define CL_LOG_SEV_NOTICE 0x6
332 #define CL_LOG_SEV_INFO 0x7
336 #define CL_LOG_SEV_DEBUG 0x8
340 #define CL_LOG_SEV_TRACE CL_LOG_TRACE
344 #define CL_LOG_SEV_MAX CL_LOG_DEBUG9
357 #define CL_LOG_FILTER_ASSIGN 0x1
362 #define CL_LOG_FILTER_MERGE_ADD 0x2
367 #define CL_LOG_FILTER_MERGE_DELETE 0x3
456 CL_IN ClInvocationT invocation,
534 CL_IN ClUint64T seqNum,
535 CL_IN ClUint32T numRecords,
536 CL_IN ClPtrT pRecords);
560 ClLogWriteCallbackT clLogWriteCallback;
568 #define CL_LOG_MSGID_BUFFER 0
573 #define CL_LOG_MSGID_PRINTF_FMT 1
578 #define CL_LOG_TAG_TERMINATE 0
589 #define CL_LOG_TAG_BASIC_SIGNED 0x1
593 #define CL_LOG_TAG_BASIC_UNSIGNED 0x2
597 #define CL_LOG_TAG_STRING 0x3
602 #define CL_LOG_TLV_UINT8(var) \
603 CL_LOG_TAG_BASIC_UNSIGNED, sizeof( var ), &(var)
608 #define CL_LOG_TLV_INT8(var) \
609 CL_LOG_TAG_BASIC_SIGNED, sizeof( var ), &(var)
614 #define CL_LOG_TLV_UINT16(var) \
615 CL_LOG_TAG_BASIC_UNSIGNED, sizeof( var ), &(var)
620 #define CL_LOG_TLV_INT16(var) \
621 CL_LOG_TAG_BASIC_SIGNED, sizeof( var ), &(var)
626 #define CL_LOG_TLV_UINT32(var) \
627 CL_LOG_TAG_BASIC_UNSIGNED, sizeof( var ), &(var)
632 #define CL_LOG_TLV_INT32(var) \
633 CL_LOG_TAG_BASIC_SIGNED, sizeof( var ), &(var)
638 #define CL_LOG_TLV_UINT64(var) \
639 CL_LOG_TAG_BASIC_UNSIGNED, sizeof( var ), &(var)
644 #define CL_LOG_TLV_INT64(var) \
645 CL_LOG_TAG_BASIC_SIGNED, sizeof( var ), &(var)
650 #define CL_LOG_TLV_STRING(var) \
651 CL_LOG_TAG_STRING, (strlen( var ) + 1), (var)
1093 ClUint16T serviceId,
1100 ClUint16T serviceId,
1107 const ClCharT *pArea,
1108 const ClCharT *pContext,
1109 ClUint16T serviceId,
1363 CL_IN ClUint64T sequenceNumber,
1364 CL_IN ClUint32T numRecords);
1431 CL_IN ClCharT *fileName,
1432 CL_IN ClCharT *fileLocation,
1433 CL_IN ClBoolT isDelete,
1548 CL_OUT ClUint32T *pNumStreams,
1625 CL_OUT ClUint32T *pNumRecords,
1626 CL_OUT ClPtrT *pLogRecords);
1684 CL_OUT ClUint32T *pNumStreams,
1713 #define clLogWrite(streamHdl, severity, libName, ...)\
1716 clLog(severity, libName, CL_LOG_CONTEXT_UNSPECIFIED, __VA_ARGS__);\
1720 clLogWriteDeferred(ClHandleT handle,
1725 ...) CL_PRINTF_FORMAT(5, 6);
1728 clLogWriteDeferredForce(ClHandleT handle,
1733 ...) CL_PRINTF_FORMAT(5, 6);
1736 clLogMsgWrite(ClHandleT streamHdl,
1738 ClUint16T serviceId,
1739 const ClCharT *pArea,
1740 const ClCharT *pContext,
1741 const ClCharT *pFileName,
1743 const ClCharT *pFmtStr,
1744 ...) CL_PRINTF_FORMAT(8, 9);
1747 clLogMsgWriteDeferred(ClHandleT streamHdl,
1749 ClUint16T serviceId,
1750 const ClCharT *pArea,
1751 const ClCharT *pContext,
1752 const ClCharT *pFileName,
1754 const ClCharT *pFmtStr,
1755 ...) CL_PRINTF_FORMAT(8, 9);
1758 clLogMsgWriteConsole(ClHandleT streamHdl,
1760 ClUint16T serviceId,
1761 const ClCharT *pArea,
1762 const ClCharT *pContext,
1763 const ClCharT *pFileName,
1765 const ClCharT *pFmtStr,
1766 ...) CL_PRINTF_FORMAT(8, 9);
1767 ClUint32T clLogFormatRecordHeader(ClCharT *msgHeader, ClUint32T maxHeaderLen, ClCharT *msg, ClBoolT consoleFlag, ClUint32T msgIdCnt,
1768 ClLogSeverityT severity, const ClCharT *pFileName, ClUint32T lineNum, const ClCharT *pArea, const ClCharT *pContext);
1769 ClUint32T clLogFormatRecord(ClCharT *msgHeader, ClUint32T maxHeaderLen, ClCharT *msg, ClUint32T maxMsgLen, ClBoolT consoleFlag, ClUint32T msgIdCnt,
1770 ClLogSeverityT severity, const ClCharT *pFileName, ClUint32T lineNum,const ClCharT *pArea, const ClCharT *pContext,
1771 const ClCharT *pFmtStr, ...);
1782 clLogStreamFilterGet(
ClNameT *pStreamName,
1788 clLogSeverityGet(const ClCharT *pSevName);
1790 extern
ClRcT clLogTimeGet(ClCharT *pStrTime, ClUint32T maxBytes);
1791 extern ClBoolT gClLogCodeLocationEnable;
1792 #define CL_LOG_PRNT_FMT_STR "%-26s [%s:%d] (%.*s.%d : %s.%3s.%3s"
1793 #define CL_LOG_PRNT_FMT_STR_CONSOLE "%-26s [%s:%d] (%.*s.%d : %s.%3s.%3s.%05d : %6s) "
1795 #define CL_LOG_PRNT_FMT_STR_WO_FILE "%-26s (%.*s.%d : %s.%3s.%3s"
1796 #define CL_LOG_PRNT_FMT_STR_WO_FILE_CONSOLE "%-26s (%.*s.%d : %s.%3s.%3s.%05d : %6s) "
1799 #include <ipi/clLogIpiWrap.h>
Typical defines found in any software project.
Header file of Log Service related Macros.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_INOUT
CL_INOUT macro assists in clearly defining arguments of an API, but has no actual meaning.
Definition: clCommon.h:108
ClInt64T ClTimeT
Time duration specified in nanoseconds.
Definition: clCommon.h:154
#define CL_OUT
CL_OUT macro assists in clearly defining arguments of an API, but has no actual meaning.
Definition: clCommon.h:110
#define CL_IN
CL_IN macro assists in clearly defining arguments of an API, but has no actual meaning.
Definition: clCommon.h:106
ClRcT clLogFileClose(CL_IN ClLogFileHandleT hFileHdlr)
Close the file which was opened for reading.
ClRcT clLogHandlerRecordAck(CL_IN ClLogStreamHandleT hStream, CL_IN ClUint64T sequenceNumber, CL_IN ClUint32T numRecords)
Function to acknowledge, receipt of Log Records, to the sender of the Log Records.
ClUint16T ClLogSeverityFilterT
Variables of this type is used as a bitmap.
Definition: clLogApi.h:352
void(* ClLogRecordDeliveryCallbackT)(CL_IN ClLogStreamHandleT hStream, CL_IN ClUint64T seqNum, CL_IN ClUint32T numRecords, CL_IN ClPtrT pRecords)
Callback function to receive log records of Log streams of interest.
Definition: clLogApi.h:532
ClUint8T ClLogStreamHandlerFlagsT
While registering as strean handler, the process should specify this flag.
Definition: clLogApi.h:249
ClRcT clLogFinalize(CL_IN ClLogHandleT hLog)
Finalize the Log service for the calling process and ensures to release all the resources.
void(* ClLogFilterSetCallbackT)(CL_IN ClLogStreamHandleT hStream, CL_IN ClLogFilterT filter)
Informs the logger about a change in filter settings of a Log stream opened by this logger.
Definition: clLogApi.h:489
ClRcT clLogHandlerRegister(CL_IN ClLogHandleT hLog, CL_IN ClNameT streamName, CL_IN ClLogStreamScopeT streamScope, CL_IN ClNameT nodeName, CL_IN ClLogStreamHandlerFlagsT handlerFlags, CL_OUT ClLogHandleT *phStream)
Registers the calling process as handler for the specified stream.
ClRcT clLogFilterSet(CL_IN ClLogStreamHandleT hStream, CL_IN ClLogFilterFlagsT filterFlags, CL_IN ClLogFilterT filter)
Changes the filter settings of a Log Stream.
ClRcT clLogFileRecordsGet(CL_IN ClLogFileHandleT hFileHdlr, CL_OUT ClTimeT *pStarTime, CL_OUT ClTimeT *pEndTime, CL_OUT ClUint32T *pNumRecords, CL_OUT ClPtrT *pLogRecords)
Gets the records from the file.
ClLogSeverityT
Definition: clLogApi.h:252
ClHandleT ClLogHandleT
The type of handle supplied by Log Service during initialization.
Definition: clLogApi.h:57
ClUint8T ClLogStreamOpenFlagsT
This flags to specify the stream should be created or opened.
Definition: clLogApi.h:186
ClLogStreamScopeT
This enumeration is used to specify the scope of the stream.
Definition: clLogApi.h:87
ClUint8T ClLogFilterFlagsT
It takes the values of above specifed flags.
Definition: clLogApi.h:372
void(* ClLogStreamOpenCallbackT)(CL_IN ClInvocationT invocation, CL_IN ClLogStreamHandleT hStream, CL_IN ClRcT rc)
This function gets called When clLogStreamOpenAsync() call returns on the server.
Definition: clLogApi.h:455
ClRcT clLogHandlerDeregister(CL_IN ClLogStreamHandleT hStream)
Deregisters the calling process as handler for the specified stream.
ClRcT clLogStreamListGet(CL_IN ClLogHandleT hLog, CL_OUT ClUint32T *pNumStreams, CL_OUT ClLogStreamInfoT **ppLogStreams)
Gets the list of active streams available in the cluster.
ClRcT clLogFileMetaDataGet(CL_IN ClLogFileHandleT hFileHdlr, CL_OUT ClLogStreamAttributesT *pStreamAttr, CL_OUT ClUint32T *pNumStreams, CL_OUT ClLogStreamMapT **ppLogStreams)
Gets the metadata of the file.
ClRcT clLogStreamOpen(CL_IN ClLogHandleT hLog, CL_IN ClNameT streamName, CL_IN ClLogStreamScopeT streamScope, CL_IN ClLogStreamAttributesT *pStreamAttr, CL_IN ClLogStreamOpenFlagsT streamOpenFlags, CL_IN ClTimeT timeout, CL_OUT ClLogStreamHandleT *phStream)
Opens the stream for Logging.
ClRcT clLogInitialize(CL_OUT ClLogHandleT *phLog, CL_IN const ClLogCallbacksT *pLogCallbacks, CL_INOUT ClVersionT *pVersion)
Initializes the Log service for the calling process and ensures the version compatability.
ClHandleT ClLogFileHandleT
The type of handle supplied by Log Service to a process who has opened a file for consuming log recor...
Definition: clLogApi.h:69
ClHandleT ClLogStreamHandleT
The type of handle supplied by Log Service during log streamOpen and a process register itself as str...
Definition: clLogApi.h:63
ClRcT clLogStreamClose(CL_IN ClLogStreamHandleT hStream)
Close the stream opened for logging.
ClRcT clLogWriteAsync(ClLogStreamHandleT hStream, ClLogSeverityT severity, ClUint16T serviceId, ClUint16T msgId,...)
Logs a Log Record in the specified Log Stream.
ClLogFileFullActionT
This enumeration is used to specify the behavior of Log Service once the Log File into which this Log...
Definition: clLogApi.h:103
ClRcT clLogFileOpen(CL_IN ClLogHandleT hLog, CL_IN ClCharT *fileName, CL_IN ClCharT *fileLocation, CL_IN ClBoolT isDelete, CL_IN ClLogFileHandleT *phFile)
Opens the current logical log file for reading the log records.
@ CL_LOG_SEV_NOTICE
setting severity as NOTICE.
Definition: clLogApi.h:276
@ CL_LOG_SEV_DEBUG
setting severity as DEBUG.
Definition: clLogApi.h:284
@ CL_LOG_SEV_EMERGENCY
setting severity as EMERGENCY.
Definition: clLogApi.h:256
@ CL_LOG_SEV_CRITICAL
setting severity as CRITICAL.
Definition: clLogApi.h:264
@ CL_LOG_SEV_WARNING
setting severity as WARNING.
Definition: clLogApi.h:272
@ CL_LOG_SEV_ALERT
setting severity as ALERT.
Definition: clLogApi.h:260
@ CL_LOG_SEV_MAX
Maximum severity level.
Definition: clLogApi.h:301
@ CL_LOG_SEV_INFO
setting severity as INFORMATION.
Definition: clLogApi.h:280
@ CL_LOG_SEV_ERROR
setting severity as ERROR.
Definition: clLogApi.h:268
@ CL_LOG_SEV_TRACE
setting severity as DEBUG.
Definition: clLogApi.h:293
@ CL_LOG_STREAM_GLOBAL
Flags specifies the streams global to the node.
Definition: clLogApi.h:91
@ CL_LOG_STREAM_LOCAL
Flag specifies the streams local to the node.
Definition: clLogApi.h:95
@ CL_LOG_FILE_FULL_ACTION_WRAP
It makes the Log Service treat the Log File as a circular buffer, i.e., when the Log File becomes ful...
Definition: clLogApi.h:116
@ CL_LOG_FILE_FULL_ACTION_ROTATE
It directs the Log Service to create a new Log File Unit when the current Log File Unit becomes full.
Definition: clLogApi.h:111
@ CL_LOG_FILE_FULL_ACTION_HALT
Log Service stops putting more records in the Log File once it becomes full.
Definition: clLogApi.h:120
A name.
Definition: clCommon.h:197
Version Information for various services.
Definition: clCommon.h:250
This structure describes the attributes of the stream.
Definition: clLogApi.h:127
ClUint32T flushFreq
Num of log records after which the log stream records must be flushed.
Definition: clLogApi.h:160
ClTimeT flushInterval
Time after which the log stream records must be flushed.
Definition: clLogApi.h:164
ClBoolT haProperty
Log file replication property.
Definition: clLogApi.h:147
ClUint32T fileUnitSize
Size of the file unit.
Definition: clLogApi.h:139
ClLogFileFullActionT fileFullAction
Action that log service has to take, when the log file unit becomes full.
Definition: clLogApi.h:151
ClUint32T recordSize
Size of the log record.
Definition: clLogApi.h:143
ClCharT * fileLocation
Its the path where the log file unit(s) will be created.
Definition: clLogApi.h:135
ClWaterMarkT waterMark
The water mark for file units.When the size of file reaches this level, the water mark event will be ...
Definition: clLogApi.h:169
ClCharT * fileName
Its the prefix name of file units that are going to be created.
Definition: clLogApi.h:131
ClUint32T maxFilesRotated
If fileAction is CL_LOG_FILE_FULL_ACTION_ROTATE, the maximum num of log file units that will be creat...
Definition: clLogApi.h:156
This structure describes all the information about the log stream.
Definition: clLogApi.h:192
ClNameT streamScopeNode
The name of the node on which the stream exist.
Definition: clLogApi.h:204
ClLogStreamAttributesT streamAttr
Attributes of the log stream.
Definition: clLogApi.h:212
ClLogStreamScopeT streamScope
Scope of the log stream.
Definition: clLogApi.h:200
ClNameT streamName
Name of the log stream.
Definition: clLogApi.h:196
ClUint16T streamId
The unique id for the stream in the cluster.
Definition: clLogApi.h:208
This structure describes the information about the log stream to stream Id mapping.
Definition: clLogApi.h:220
ClNameT streamName
Name of the log stream.
Definition: clLogApi.h:224
ClLogStreamScopeT streamScope
Scope of the log stream.
Definition: clLogApi.h:228
ClNameT nodeName
Node name on which the stream exist.
Definition: clLogApi.h:232
ClUint16T streamId
Unique id of the stream in the cluster.
Definition: clLogApi.h:236
This structure describes the filter settings for the stream.
Definition: clLogApi.h:379
ClUint8T * pMsgIdSet
This memory will be treated as bitmap to mask the message ids.
Definition: clLogApi.h:391
ClUint16T compIdSetLength
The size of the memory pointed by pCompIdSet in bytes.
Definition: clLogApi.h:395
ClLogSeverityFilterT severityFilter
This field identifies the severity level.
Definition: clLogApi.h:383
ClUint16T msgIdSetLength
The size of the memory pointed by pMsgIdSet in bytes.
Definition: clLogApi.h:387
ClUint8T * pCompIdSet
This memory will be treated as bitmap to mask the component ids.
Definition: clLogApi.h:399
This structure describes about the callbacks which can be provided by process while initializing with...
Definition: clLogApi.h:543
ClLogFilterSetCallbackT clLogFilterSetCb
Callback for informing filter settings updation.
Definition: clLogApi.h:551
ClLogRecordDeliveryCallbackT clLogRecordDeliveryCb
Callback for delivering records to stream handlers.
Definition: clLogApi.h:555
ClLogStreamOpenCallbackT clLogStreamOpenCb
Callback for stream open.
Definition: clLogApi.h:547