siso_log.h File Reference

siso_log.h File Reference

Function declarations for the user logging interface. More...

#include <unistd.h>
#include <pthread.h>

Go to the source code of this file.

Data Structures

struct  tSisoLogTag
 structure for logging tags More...
 

Macros

#define SISOLOG_ERROR_INTERNAL_ERROR   -1
 
#define SISOLOG_ERROR_LIB_ALREADY_LOADED   -3
 
#define SISOLOG_ERROR_LIB_NOT_LOADED   -2
 
#define SISOLOG_ERROR_UNRESOLVED_SYMBOL   -4
 
#define SISOLOG_LOGLEVEL_ERROR   5
 
#define SISOLOG_LOGLEVEL_FATAL   6
 
#define SISOLOG_LOGLEVEL_WARN   4
 
#define SISOLOG_MODE_DEFAULT   1
 
#define SISOLOG_MODE_OFF   0
 
#define SISOLOG_OK   0
 

Typedefs

typedef void FuncType_LogMsgCallback(tProcessId pid, tThreadId tid, const char *const logger, unsigned int level, const char *const msg, unsigned int tagcount, const tSisoLogTag *const tags, void *userdata)
 Callback function definition for log events.
 
typedef pid_t tProcessId
 
typedef struct tSisoLogTag tSisoLog_Tag
 structure for logging tags
 
typedef pthread_t tThreadId
 

Functions

int SisoLog_FreeLibrary ()
 The function SisoLog_FreeLibrary() releases internal structures of the library.
 
int SisoLog_GetMode (unsigned int *mode)
 The function SisoLog_GetMode() returns the current mode for the library.
 
int SisoLog_InitLibrary ()
 The function SisoLog_InitLibrary() initializes internal structures of the library.
 
int SisoLog_RegisterLogMsgCallback (FuncType_LogMsgCallback *callback, void *userdata)
 Register the user callback for log events.
 
int SisoLog_SetMode (unsigned int mode)
 The function SisoLog_SetMode() set the mode for the library.
 

Detailed Description

Function declarations for the user logging interface.

siso_log.h

Copyright (c) 2021 Basler AG, All Rights Reserved.

Author
Basler AG

Macro Definition Documentation

◆ SISOLOG_ERROR_INTERNAL_ERROR

#define SISOLOG_ERROR_INTERNAL_ERROR   -1

logging return value: ERROR - Internal error

◆ SISOLOG_ERROR_LIB_ALREADY_LOADED

#define SISOLOG_ERROR_LIB_ALREADY_LOADED   -3

logging return value: ERROR - Library already loaded

◆ SISOLOG_ERROR_LIB_NOT_LOADED

#define SISOLOG_ERROR_LIB_NOT_LOADED   -2

logging return value: ERROR - Library not loaded

◆ SISOLOG_ERROR_UNRESOLVED_SYMBOL

#define SISOLOG_ERROR_UNRESOLVED_SYMBOL   -4

logging return value: ERROR - Unresolved symbol

◆ SISOLOG_LOGLEVEL_ERROR

#define SISOLOG_LOGLEVEL_ERROR   5

logging level: ERROR

◆ SISOLOG_LOGLEVEL_FATAL

#define SISOLOG_LOGLEVEL_FATAL   6

logging level: FATAL

◆ SISOLOG_LOGLEVEL_WARN

#define SISOLOG_LOGLEVEL_WARN   4

logging level: WARN

◆ SISOLOG_MODE_DEFAULT

#define SISOLOG_MODE_DEFAULT   1

logging mode: DEFAULT

◆ SISOLOG_MODE_OFF

#define SISOLOG_MODE_OFF   0

logging mode: OFF

◆ SISOLOG_OK

#define SISOLOG_OK   0

logging return value: SUCCESS

Typedef Documentation

◆ FuncType_LogMsgCallback

typedef void FuncType_LogMsgCallback(tProcessId pid, tThreadId tid, const char *const logger, unsigned int level, const char *const msg, unsigned int tagcount, const tSisoLogTag *const tags, void *userdata)

Callback function definition for log events.

Parameters
pidprocess id of the log event source process
tidthread id of the log event source thread
loggername of the log event source logger
levellogging level of the log event
msglogging message of the log event
tagcountnumber of attached logging tags of the log event
tagslogging tags array
userdatauser data pointer from the matching call to SisoLog_RegisterLogMsgCallback

◆ tProcessId

typedef pid_t tProcessId

typedef for process ids

◆ tSisoLog_Tag

typedef struct tSisoLogTag tSisoLog_Tag

structure for logging tags

◆ tThreadId

typedef pthread_t tThreadId

typedef for thread ids

Function Documentation

◆ SisoLog_FreeLibrary()

int SisoLog_FreeLibrary ( )

The function SisoLog_FreeLibrary() releases internal structures of the library.

This function releases all internal structures that were initialized by a successful call Fg_InitLibraries().

Returns
0 on success, or a non-zero error value otherwise

◆ SisoLog_GetMode()

int SisoLog_GetMode ( unsigned int * mode)

The function SisoLog_GetMode() returns the current mode for the library.

Parameters
modepointer to the mode variable where the current mode will be stored to
Returns
0 on success, or a non-zero error value otherwise

◆ SisoLog_InitLibrary()

int SisoLog_InitLibrary ( )

The function SisoLog_InitLibrary() initializes internal structures of the library.

This function initializes internal structures in the library and keeps them in memory until SisoLog_FreeLibrary() is called.

Returns
0 on success, or a non-zero error value otherwise

◆ SisoLog_RegisterLogMsgCallback()

int SisoLog_RegisterLogMsgCallback ( FuncType_LogMsgCallback * callback,
void * userdata )

Register the user callback for log events.

Parameters
callbackpointer to the user callback function
userdataa use specific pointer, which will be returned on each callback
Returns
0 on success, or a non-zero error value otherwise

◆ SisoLog_SetMode()

int SisoLog_SetMode ( unsigned int mode)

The function SisoLog_SetMode() set the mode for the library.

Allowed values are: SISOLOG_MODE_OFF and SISOLOG_MODE_DEFAULT.

Parameters
modethe mode value to be set
Returns
0 on success, or a non-zero error value otherwise