IoTivity-Lite
|
OCF public log functions. More...
#include "oc_config.h"
#include "oc_export.h"
#include "util/oc_compiler.h"
#include "util/oc_features.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
Typedefs | |
typedef void(* | oc_print_log_fn_t) (oc_log_level_t level, oc_log_component_t component, const char *file, int line, const char *func_name, const char *format,...) |
Custom logging function. More... | |
Enumerations | |
enum | oc_log_component_t { OC_LOG_COMPONENT_DEFAULT = 1 << 0 , OC_LOG_COMPONENT_CLOUD = 1 << 1 , OC_LOG_COMPONENT_COAP = 1 << 2 , OC_LOG_COMPONENT_DEVICE_PROVISIONING = 1 << 3 } |
Log component determines the source of the message. More... | |
enum | oc_log_level_t { OC_LOG_LEVEL_DISABLED = OC_LOG_LEVEL_DISABLED_MACRO , OC_LOG_LEVEL_ERROR = OC_LOG_LEVEL_ERROR_MACRO , OC_LOG_LEVEL_WARNING = OC_LOG_LEVEL_WARNING_MACRO , OC_LOG_LEVEL_NOTICE , OC_LOG_LEVEL_INFO = OC_LOG_LEVEL_INFO_MACRO , OC_LOG_LEVEL_DEBUG = OC_LOG_LEVEL_DEBUG_MACRO , OC_LOG_LEVEL_TRACE = OC_LOG_LEVEL_TRACE_MACRO } |
Log level determines the importance of the message. More... | |
Functions | |
const char * | oc_log_component_name (oc_log_component_t component) 1 |
Get component name. More... | |
oc_log_level_t | oc_log_get_level (void) |
Get log level of the global logger. More... | |
const char * | oc_log_level_to_label (oc_log_level_t level) 1 |
Convert log level to string. More... | |
void | oc_log_set_function (oc_print_log_fn_t log_func) |
Set log callback function. More... | |
void | oc_log_set_level (oc_log_level_t level) |
Set log level of the global logger, logs with lower importance will be ignored. More... | |
OCF public log functions.
Allow to set log callback function and level.
#define OC_PRINT_ENDPOINT_ADDR | ( | endpoint, | |
addr_memb | |||
) |
typedef void(* oc_print_log_fn_t) (oc_log_level_t level, oc_log_component_t component, const char *file, int line, const char *func_name, const char *format,...) |
Custom logging function.
level | log level of the message |
component | log component of the message |
file | file of the log message call |
line | line of the log message call in file |
func_name | function name in which the log message call is invoked |
format | format of the log message |
enum oc_log_component_t |
enum oc_log_level_t |
Log level determines the importance of the message.
The levels are in order of decreasing importance.
const char* oc_log_component_name | ( | oc_log_component_t | component | ) |
Get component name.
It is thread safe.
component | Component type |
oc_log_level_t oc_log_get_level | ( | void | ) |
Get log level of the global logger.
It is thread safe.
const char* oc_log_level_to_label | ( | oc_log_level_t | level | ) |
Convert log level to string.
It is thread safe.
void oc_log_set_function | ( | oc_print_log_fn_t | log_func | ) |
Set log callback function.
It is recommended to set it before oc_main_init because it is not thread safe.
log_func | Log callback function |
void oc_log_set_level | ( | oc_log_level_t | level | ) |
Set log level of the global logger, logs with lower importance will be ignored.
It is thread safe.
level | Log level |