RDK Documentation (Open Sourced RDK Components)
|
Modules | |
DCA Data types | |
Data Structures | |
struct | logtype_pair |
struct | pclist |
union | pclist.__unnamed__ |
struct | _procMemCpuInfo |
Macros | |
#define | RDK_DEBUG_DEFINE_STRINGS |
#define | WANT_LOG(mod, lvl) ( ( ((mod) >= 0) && ((mod) < RDK_MAX_MOD_COUNT) ) ? (rdk_g_logControlTbl[(mod)] & (1 << (lvl))) : 0 ) |
#define | SKIPWHITE(cptr) while ((*cptr != '\0') && isspace(*cptr)) cptr++ |
#define | LOG_TRACE |
#define | LOG_ALL |
#define | LOG_NONE 0 |
#define | HOSTADDR_STR_MAX 255 |
#define | MAX_LOGLINE_LENGTH 4096 |
#define | COMCAST_DATAED_BUFF_SIZE 40 |
#define | BUF_LEN 256 |
#define | INVALID_COUNT "-406" |
#define | LOG_FILE "dcmscript.log" |
#define | NUM_OF_LOG_TYPES (sizeof(log_type_table)/sizeof(log_type_table[0])) |
#define | MAXLEN 512 |
#define | MAXLEN 512 |
#define | LEN 14 |
#define | BUF_LEN 20 |
#define | CMD_LEN 256 |
#define | MAXLEN 512 |
#define | PID_SIZE 10 |
#define | PIDOF_SIZE 50 |
#define | MEM_STRING_SIZE 20 |
#define | PROC_PATH_SIZE 50 |
#define | LEN 14 |
#define | BUF_LEN 16 |
#define | CMD_LEN 256 |
#define | MAXLEN 512 |
#define | PID_SIZE 10 |
#define | PIDOF_SIZE 50 |
#define | MEM_STRING_SIZE 20 |
#define | PROC_PATH_SIZE 50 |
#define | EC_BUF_LEN 20 |
#define | MAXLINE 4096 |
#define | MAXLEN 512 |
#define | LEN 14 |
#define | USLEEP_SEC 100 |
#define | MAX_PROCESS 10 |
#define | RDK_EC_MAXLEN 5 /* RDK Error code maximum length */ |
#define | RTL_FILENAME "/.rtl_temp.log" |
#define | EXEC_COUNTER_FILENAME "/tmp/.dcaCounter.txt" |
#define | INCLUDE_PROPERTIES "/etc/include.properties" |
#define | DEVICE_PROPERTIES "/etc/device.properties" |
#define | DELIMITER "<#=#>" |
#define | DEFAULT_SEEK_PREFIX "/opt/.telemetry/tmp/rtl_" |
#define | DEFAULT_LOG_PATH "/opt/logs/" |
#define | LOG(fmt, __etc...) |
#define | UNREFERENCED_PARAMETER(_p_) (void)(_p_) |
Typedefs | |
typedef struct logtype_pair | LOGTYPE_PAIR |
typedef struct pclist | pcdata_t |
typedef struct _procMemCpuInfo | procMemCpuInfo |
Enumerations | |
enum | |
enum | |
enum | logType_e |
enum | DType_t |
Functions | |
static void | TouchFile (const char *pszFile) |
Touch the file which can be used to check whether to log or not. More... | |
void | rdk_dbgDumpLog (const char *path) |
Dump the debug log. It will Dump all the current settings so that an analysis of a log file will include what logging information to expect. More... | |
void | rdk_dbgInit () |
Initialize the underlying MPEOS debug support. This API must be called only once per boot cycle. More... | |
void | rdk_dbg_MsgRaw (rdk_LogLevel level, const char *module, const char *format,...) |
Send a debugging message to the debugging window. It is appended to the log output based on configurations set in the environment file. More... | |
void | rdk_dbg_MsgRaw1 (rdk_LogLevel level, const char *module, const char *format, va_list args) |
static int | initLogger (char *category) |
static const char * | dated_format_nocr (const log4c_layout_t *a_layout, const log4c_logging_event_t *a_event) |
static const char * | basic_format_nocr (const log4c_layout_t *a_layout, const log4c_logging_event_t *a_event) |
static const char * | comcast_dated_format_nocr (const log4c_layout_t *a_layout, log4c_logging_event_t *a_event) |
static int | stream_env_overwrite_open (log4c_appender_t *appender) |
static int | stream_env_append_open (log4c_appender_t *appender) |
static int | stream_env_append (log4c_appender_t *appender, const log4c_logging_event_t *event) |
static int | stream_env_plus_stdout_append (log4c_appender_t *appender, const log4c_logging_event_t *event) |
static int | stream_env_close (log4c_appender_t *appender) |
void | rdk_dbg_priv_Init () |
static void | forceUpperCase (char *token) |
static int | logNameToEnum (const char *name) |
static void | extractToken (const char **srcStr, char *tokBuf) |
static int | parseLogConfig (const char *cfgStr, uint32_t *configEntry, const char **msg) |
static void | printTime (const struct tm *pTm, char *pBuff) |
void | rdk_dbg_priv_LogControlInit (void) |
rdk_logger_Bool | rdk_dbg_enabled (const char *module, rdk_LogLevel level) |
Function to check if a specific log level of a module is enabled. More... | |
void | rdk_dbg_priv_SetLogLevelString (const char *pszModuleName, const char *pszLogLevels) |
const char * | rdk_dbg_priv_LogQueryOpSysIntf (char *modName, char *cfgStr, int cfgStrMaxLen) |
void | rdk_debug_priv_log_msg (rdk_LogLevel level, int module, const char *module_name, const char *format, va_list args) |
void | RDK_LOG_ControlCB (const char *moduleName, const char *subComponentName, const char *loggingLevel, int log_status) |
static int | stream_env_open (log4c_appender_t *appender, int append) |
rdk_Error | rdk_logger_init (const char *debugConfigFile) |
Initialize the logger. Sets up the environment variable storage by parsing debug configuration file then Initialize the debug support to the underlying platform. More... | |
rdk_Error | rdk_logger_deinit () |
Cleanup the logger instantiation. More... | |
int | get_log_type_from_name (char *name, enum logType_e *type_ptr) |
int | getCpuUsage (char *cpuUtil) |
To get CPU usage of the device. More... | |
int | insertPCNode (GList **pch, char *pattern, char *header, DType_t dtype, int count, char *data) |
To insert a new pattern node at the beginning of the list. More... | |
gint | comparePattern (gconstpointer np, gconstpointer sp) |
To do custom comparison. More... | |
pcdata_t * | searchPCNode (GList *pch, char *pattern) |
To search node from the list based on the given pattern. More... | |
void | print_pc_node (gpointer data, gpointer user_data) |
Debug function to print the node. More... | |
void | printPCNodes (GList *pch) |
Debug function to print all nodes in the list. More... | |
void | freePCNode (gpointer node) |
To delete a node. More... | |
void | clearPCNodes (GList **pch) |
To delete/clear all the nodes in the list. More... | |
int | getMemoryUsage (char *memoryUtilization) |
To get memory usage of the device. More... | |
bool | getProcInfo (procMemCpuInfo *pInfo) |
int | main (int argc, char *argv[]) |
int | getLoadAvg (void) |
This API is to find the load average of system and add it to the SearchResult JSON. More... | |
char * | getsRotatedLog (char *buf, int buflen, char *name) |
Function to return rotated log file. More... | |
void | clearConfVal (void) |
This function is to clear/free the global paths. | |
void | updateIncludeConfVal (char *logpath, char *perspath) |
Function to update the global paths like PERSISTENT_PATH,LOG_PATH from include.properties file. More... | |
void | updateConfVal (char *logpath, char *perspath) |
Function to update the configuration values from device.properties file. More... | |
int | readLogSeek (char *name, long *seek_value) |
Function to read the rotated Log file. More... | |
void | writeLogSeek (char *name, long seek_value) |
Function to write the rotated Log file. More... | |
int | checkLogSeek (char *name, long prevSeekVal) |
int | isSkipParam (int skipInterval) |
This API is to verify whether to skip this telemetry marker. More... | |
void | updateExecCounter (void) |
To update current dca execution count. | |
void | saveExecCounter (void) |
void | initSearchResultJson (cJSON **root, cJSON **sr) |
This API creates "searchResult" JSON array. More... | |
void | addToSearchResult (char *key, char *value) |
This API is to append the key/value pair to the SearchResult JSON array . More... | |
void | clearSearchResultJson (cJSON **root) |
This API deletes the result JSON object. More... | |
void | printJson (cJSON *root) |
This API is to print Json result. More... | |
int | getProcUsage (char *processName) |
To get process usage. More... | |
Variables | |
int | global_count |
static int | g_debugEnabled = 1 |
Debugging messages are enabled. Default is enabled (1) and 0 for off. | |
int | global_count |
static rdk_logger_Bool | g_initialized = FALSE |
uint32_t | rdk_g_logControlTbl [RDK_MAX_MOD_COUNT] |
rdk_logger_Bool | dbg_logViaUDP = FALSE |
int | dbg_udpSocket |
struct sockaddr_in | dbg_logHostAddr |
log4c_category_t * | stackCat = NULL |
static const char * | errorMsgs [] |
static log4c_category_t * | defaultCategory = NULL |
static log4c_category_t * | glibCategory = NULL |
static const log4c_layout_type_t | log4c_layout_type_dated_nocr |
static const log4c_layout_type_t | log4c_layout_type_basic_nocr |
static const log4c_layout_type_t | log4c_layout_type_comcast_dated_nocr |
static const log4c_appender_type_t | log4c_appender_type_stream_env |
static const log4c_appender_type_t | log4c_appender_type_stream_env_append |
static const log4c_appender_type_t | log4c_appender_type_stream_env_plus_stdout |
static const log4c_appender_type_t | log4c_appender_type_stream_env_append_plus_stdout |
static int | isLogInited = 0 |
LOGTYPE_PAIR | log_type_table [] |
GList * | pchead |
char * | PERSISTENT_PATH |
char * | LOG_PATH |
char * | DEVICE_TYPE |
char * | RTL_TEMP_LOG_FILE |
char * | OUTPUT_FILE |
cJSON * | SEARCH_RESULT_JSON |
cJSON * | ROOT_JSON |
int | CUR_EXEC_COUNT |
long | LAST_SEEK_VALUE |
struct logtype_pair |
struct pclist |
union pclist.__unnamed__ |
struct _procMemCpuInfo |
#define WANT_LOG | ( | mod, | |
lvl | |||
) | ( ( ((mod) >= 0) && ((mod) < RDK_MAX_MOD_COUNT) ) ? (rdk_g_logControlTbl[(mod)] & (1 << (lvl))) : 0 ) |
Returns 1 if logging has been requested for the corresponding module (mod) and level (lvl) combination. To be used in rdk_dbg_priv_* files ONLY.
Definition at line 76 of file rdk_debug_priv.c.
#define SKIPWHITE | ( | cptr | ) | while ((*cptr != '\0') && isspace(*cptr)) cptr++ |
Skip whitespace in a c-style string.
Definition at line 80 of file rdk_debug_priv.c.
#define LOG_TRACE |
Bit mask for trace (TRACE1 thru TRACE9) logging levels.
Definition at line 83 of file rdk_debug_priv.c.
#define LOG_ALL |
Turns on FATAL, ERROR, WARN NOTICE & INFO.
Definition at line 88 of file rdk_debug_priv.c.
#define LOG_NONE 0 |
All logging 'off'.
Definition at line 93 of file rdk_debug_priv.c.
#define LOG | ( | fmt, | |
__etc... | |||
) |
Definition at line 77 of file dcautils.h.
anonymous enum |
Enumerator | |
---|---|
ERR_INVALID_MOD_NAME | Used as an array index. |
Definition at line 129 of file rdk_debug_priv.c.
|
static |
Touch the file which can be used to check whether to log or not.
[in] | pszFile | Character string representing name of the file to be created. |
Definition at line 48 of file rdk_debug.c.
void rdk_dbgDumpLog | ( | const char * | path | ) |
Dump the debug log. It will Dump all the current settings so that an analysis of a log file will include what logging information to expect.
[in] | path | Character string representing path of the temp file to be created. |
Definition at line 67 of file rdk_debug.c.
void rdk_dbgInit | ( | ) |
Initialize the underlying MPEOS debug support. This API must be called only once per boot cycle.
Definition at line 100 of file rdk_debug.c.
void rdk_dbg_MsgRaw | ( | rdk_LogLevel | level, |
const char * | module, | ||
const char * | format, | ||
... | |||
) |
Send a debugging message to the debugging window. It is appended to the log output based on configurations set in the environment file.
[in] | level | The debug logging level. |
[in] | module | The name of the module for which this message belongs to, it is mentioned in debug.ini. |
[in] | format | Printf style string containing the log message. |
Definition at line 119 of file rdk_debug.c.
|
static |
Instantiate the logger...
cat | The category string for this instance logging/filtering |
Definition at line 661 of file rdk_debug_priv.c.
|
static |
Safely force a string to uppercase. I hate this mundane rubbish.
token | String to be forced to uppercase. |
Definition at line 202 of file rdk_debug_priv.c.
|
static |
Convert a log level name to the correspodning log level enum value.
name | Log level name, which must be uppercase. |
Corresponding | enumeration value or -1 on error. |
Definition at line 220 of file rdk_debug_priv.c.
|
static |
Extract a whitespace delimited token from a string.
srcStr | Pointer to the source string, this will be modified to point to the first character after the token extracted. |
tokBuf | This is a string that will be filled with the token. Note: this buffer is assumed to be large enough to hold the largest possible token. |
Definition at line 245 of file rdk_debug_priv.c.
|
static |
Parse a whitespace delimited list of log types and log type meta names.
cfgStr | String containing one more log types. (Right hand side of INI file entry.) |
defConfig | Default configuration to base the return value on. |
Definition at line 267 of file rdk_debug_priv.c.
void rdk_dbg_priv_LogControlInit | ( | void | ) |
Initialize the debug log control table. This should be called from the initialization routine of the debug manager.
Definition at line 366 of file rdk_debug_priv.c.
rdk_logger_Bool rdk_dbg_enabled | ( | const char * | module, |
rdk_LogLevel | level | ||
) |
Function to check if a specific log level of a module is enabled.
[in] | module | The module name or category for for which the log level shall be checked (as mentioned in debug.ini). |
[in] | level | The debug logging level. |
Definition at line 415 of file rdk_debug_priv.c.
void rdk_dbg_priv_SetLogLevelString | ( | const char * | pszModuleName, |
const char * | pszLogLevels | ||
) |
Modify the debug log control table.
Definition at line 431 of file rdk_debug_priv.c.
const char* rdk_dbg_priv_LogQueryOpSysIntf | ( | char * | modName, |
char * | cfgStr, | ||
int | cfgStrMaxLen | ||
) |
Provides an interface to query the configuration of logging in a specific module as a user readable string. Note: the mimimum acceptable length of the supplied configuration buffer is 32 bytes.
modName | Name of the module. |
cfgStr | The configuration strng: which should be space separated module names. |
cfgStrMaxLen | The maximum length of the configuration string to be returned including the NUL character. |
Definition at line 490 of file rdk_debug_priv.c.
rdk_Error rdk_logger_init | ( | const char * | debugConfigFile | ) |
Initialize the logger. Sets up the environment variable storage by parsing debug configuration file then Initialize the debug support to the underlying platform.
[in] | debugConfigFile | The character pointer variable of debug configuration file. |
Definition at line 57 of file rdk_logger_init.c.
rdk_Error rdk_logger_deinit | ( | ) |
Cleanup the logger instantiation.
Definition at line 108 of file rdk_logger_init.c.
int getCpuUsage | ( | char * | cpuUtil | ) |
int insertPCNode | ( | GList ** | pch, |
char * | pattern, | ||
char * | header, | ||
DType_t | dtype, | ||
int | count, | ||
char * | data | ||
) |
gint comparePattern | ( | gconstpointer | np, |
gconstpointer | sp | ||
) |
pcdata_t * searchPCNode | ( | GList * | pch, |
char * | pattern | ||
) |
void print_pc_node | ( | gpointer | data, |
gpointer | user_data | ||
) |
void printPCNodes | ( | GList * | pch | ) |
void freePCNode | ( | gpointer | node | ) |
void clearPCNodes | ( | GList ** | pch | ) |
int getMemoryUsage | ( | char * | memoryUtilization | ) |
int getLoadAvg | ( | ) |
This API is to find the load average of system and add it to the SearchResult JSON.
Return | 1 on success. |
Definition at line 57 of file dcautils.c.
char* getsRotatedLog | ( | char * | buf, |
int | buflen, | ||
char * | name | ||
) |
Function to return rotated log file.
[in] | buf | Buffer |
[in] | buflen | Maximum buffer length |
[in] | name | Current Log file |
Definition at line 190 of file dcautils.c.
void updateIncludeConfVal | ( | char * | logpath, |
char * | perspath | ||
) |
Function to update the global paths like PERSISTENT_PATH,LOG_PATH from include.properties file.
[in] | logpath | Log file path |
[in] | perspath | Persistent path |
Definition at line 397 of file dcautils.c.
void updateConfVal | ( | char * | logpath, |
char * | perspath | ||
) |
Function to update the configuration values from device.properties file.
[in] | logpath | Log file path |
[in] | perspath | Persistent path |
Definition at line 491 of file dcautils.c.
int readLogSeek | ( | char * | name, |
long * | seek_value | ||
) |
Function to read the rotated Log file.
[in] | name | Log file name. |
[in] | seek_value | Position to seek. |
Returns | -1 on failure, appropriate errorcode otherwise. |
Definition at line 635 of file dcautils.c.
void writeLogSeek | ( | char * | name, |
long | seek_value | ||
) |
Function to write the rotated Log file.
[in] | name | Log file name. |
[in] | seek_value | Position to seek. |
Returns | -1 on failure, appropriate errorcode otherwise. |
Definition at line 678 of file dcautils.c.
int isSkipParam | ( | int | skipInterval | ) |
This API is to verify whether to skip this telemetry marker.
[in] | skipInterval | Polling frequency |
Definition at line 163 of file dcautils.c.
void initSearchResultJson | ( | cJSON ** | root, |
cJSON ** | sr | ||
) |
This API creates "searchResult" JSON array.
The search result list contains collection of telemetry marker headers with their value.
Eg: {"searchResult":[{"MOCA_INFO_pnc_enabled":"1"},{"samv2_boardver_split":" V3.0 ##"},{"RF_ERR_DS_lockfail":"1"},{"RF_ERR_T3_timeout":"2"}]}
[out] | root | JSON object |
[in] | sr | Search result JSON array |
void addToSearchResult | ( | char * | key, |
char * | value | ||
) |
void clearSearchResultJson | ( | cJSON ** | root | ) |
void printJson | ( | cJSON * | root | ) |
int getProcUsage | ( | char * | processName | ) |
int global_count |
Global count for the modules
Definition at line 55 of file rdk_logger_util.c.
int global_count |
Global count for the modules
Definition at line 55 of file rdk_logger_util.c.
uint32_t rdk_g_logControlTbl[RDK_MAX_MOD_COUNT] |
Global variable used to control logging.
Definition at line 120 of file rdk_debug_priv.c.
rdk_logger_Bool dbg_logViaUDP = FALSE |
UDP logging variables.
Definition at line 123 of file rdk_debug_priv.c.
|
static |
Definition at line 140 of file rdk_debug_priv.c.
|
static |
Initialize Debug API.
Definition at line 147 of file rdk_debug_priv.c.
|
static |
Definition at line 150 of file rdk_debug_priv.c.
|
static |
Definition at line 153 of file rdk_debug_priv.c.
|
static |
Definition at line 156 of file rdk_debug_priv.c.
|
static |
Definition at line 160 of file rdk_debug_priv.c.
|
static |
Definition at line 164 of file rdk_debug_priv.c.
|
static |
Definition at line 168 of file rdk_debug_priv.c.
|
static |
Definition at line 172 of file rdk_debug_priv.c.
LOGTYPE_PAIR log_type_table[] |