mcl_log_util.h File Reference

Log utility module interface header file. More...

Include dependency graph for mcl_log_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MCL_LOG_ENABLED_COMPILE_TIME(level)    ((level) >= MCL_LOG_LEVEL)
 
#define MCL_LOG_ENABLED_RUN_TIME(level)    ((level) >= mcl_log_util_get_output_level())
 
#define MCL_LOG_DISABLED   (!MCL_LOG_ENABLED_COMPILE_TIME(MCL_LOG_LEVEL_FATAL))
 
#define MCL_LOG_TAG_DEFAULT   "[..]"
 
#define MCL_LOG_TAG_ENTRY   "[->]"
 
#define MCL_LOG_TAG_LEAVE   "[<-]"
 
#define MCL_LOG_WRITE(level, tag, ...)
 
#define MCL_VERBOSE(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_VERBOSE, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_VERBOSE_ENTRY(...)   MCL_LOG_WRITE(MCL_LOG_LEVEL_VERBOSE, MCL_LOG_TAG_ENTRY, __VA_ARGS__)
 
#define MCL_VERBOSE_LEAVE(...)   MCL_LOG_WRITE(MCL_LOG_LEVEL_VERBOSE, MCL_LOG_TAG_LEAVE, __VA_ARGS__)
 
#define MCL_VERBOSE_STRING(string)   MCL_VERBOSE("%s", string)
 
#define MCL_DEBUG(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_DEBUG, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_DEBUG_ENTRY(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_DEBUG, MCL_LOG_TAG_ENTRY, __VA_ARGS__)
 
#define MCL_DEBUG_LEAVE(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_DEBUG, MCL_LOG_TAG_LEAVE, __VA_ARGS__)
 
#define MCL_DEBUG_STRING(string)    MCL_DEBUG("%s", string)
 
#define MCL_INFO(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_INFO, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_INFO_STRING(string)    MCL_INFO("%s", string)
 
#define MCL_WARN(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_WARN, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_WARN_STRING(string)    MCL_WARN("%s", string)
 
#define MCL_ERROR(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_ERROR, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_ERROR_STRING(string)    MCL_ERROR("%s", string)
 
#define MCL_FATAL(...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_FATAL, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)
 
#define MCL_FATAL_STRING(string)    MCL_FATAL("%s", string)
 

Typedefs

typedef void(* mcl_log_util_callback_t) (void *user_context, int log_level, const char *file, int line, const char *tag, const char *const format,...)
 

Functions

MCL_CORE_EXPORT mcl_error_t mcl_log_util_set_callback (mcl_log_util_callback_t callback, void *user_context)
 
MCL_CORE_EXPORT mcl_error_t mcl_log_util_set_output_level (const int log_level)
 
MCL_CORE_EXPORT int mcl_log_util_get_output_level (void)
 

Variables

MCL_CORE_EXPORT mcl_log_util_callback_t mcl_log_util_function
 
MCL_CORE_EXPORT void * mcl_log_util_user_context
 

Detailed Description

Log utility module interface header file.

This utility module defines macros and functions for logging purposes.

Definition in file mcl_log_util.h.

Macro Definition Documentation

#define MCL_DEBUG_ENTRY (   ...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_DEBUG, MCL_LOG_TAG_ENTRY, __VA_ARGS__)

Definition at line 115 of file mcl_log_util.h.

Referenced by _add_jwks(), _add_key_to_keys_array(), _add_schema_to_jwt(), _base64_encode_big_number(), _calculate_signature(), _certificate_list_destroy_callback(), _check_client_secret(), _check_rsa_private_key(), _compose_access_token_request_payload(), _compose_rsa_key_rotation_json(), _compose_rsa_onboarding_json(), _convert_to_mcl_return_code(), _create_self_issued_jwt_header(), _create_self_issued_jwt_payload(), _custom_load_register_info(), _decode_quantum(), _decode_with_table(), _encode_with_table(), _generate_correlation_id_string(), _generate_token(), _get_header_and_payload_encoded_base64_url(), _get_rsa_private_key(), _get_rsa_public_key(), _is_empty_line(), _join_with_dot(), _load_initial_credentials(), _print_formatted_string(), _process_registration_response(), _process_registration_response_rsa_3072(), _process_registration_response_shared_secret(), _request_payload_callback_for_put(), _response_header_callback(), _response_payload_callback(), _save_credentials(), _set_in_file_size(), _set_payload_options(), _set_request_options(), _ssl_context_callback(), base64_decode(), base64_encode(), base64_url_decode(), base64_url_encode(), core_configuration_log(), core_configuration_validate(), core_processor_destroy(), core_processor_get_access_token(), core_processor_initialize(), core_processor_register(), core_processor_update_credentials(), get_chunked_response(), get_content_length_response(), get_response(), hmac_sha256(), json_util_initialize_json_library(), jwt_destroy(), jwt_get_token(), jwt_initialize(), mcl_core_configuration_destroy(), mcl_core_configuration_initialize(), mcl_core_configuration_set_parameter(), mcl_core_destroy(), mcl_core_get_access_token(), mcl_core_get_client_id(), mcl_core_get_host_name(), mcl_core_get_http_client(), mcl_core_get_last_access_token(), mcl_core_get_last_token_time(), mcl_core_initialize(), mcl_core_is_onboarded(), mcl_core_onboard(), mcl_core_rotate_key(), mcl_core_update_credentials(), mcl_file_util_check_if_regular_file(), mcl_file_util_fclose(), mcl_file_util_fflush(), mcl_file_util_fgets(), mcl_file_util_fopen(), mcl_file_util_fputs(), mcl_file_util_fread(), mcl_file_util_fwrite(), mcl_file_util_get_file_size(), mcl_file_util_get_time_of_last_status_change(), mcl_file_util_rewind(), mcl_http_client_add_certificate(), mcl_http_client_destroy(), mcl_http_client_initialize(), mcl_http_client_send(), mcl_http_request_add_header(), mcl_http_request_destroy(), mcl_http_request_initialize(), mcl_http_request_set_parameter(), mcl_http_response_destroy(), mcl_http_response_get_header(), mcl_http_response_get_status(), mcl_http_response_initialize(), mcl_json_util_add_bool(), mcl_json_util_add_double(), mcl_json_util_add_item_to_array(), mcl_json_util_add_null(), mcl_json_util_add_object(), mcl_json_util_add_string(), mcl_json_util_add_uint(), mcl_json_util_destroy(), mcl_json_util_duplicate(), mcl_json_util_get_array_item(), mcl_json_util_get_array_size(), mcl_json_util_get_bool_value(), mcl_json_util_get_double_value(), mcl_json_util_get_number_value(), mcl_json_util_get_object_item(), mcl_json_util_get_string(), mcl_json_util_has_child(), mcl_json_util_initialize(), mcl_json_util_library_initialize(), mcl_json_util_parse(), mcl_json_util_start_array(), mcl_json_util_start_object(), mcl_json_util_to_string(), mcl_list_add(), mcl_list_destroy(), mcl_list_destroy_with_content(), mcl_list_exist(), mcl_list_initialize(), mcl_list_next(), mcl_list_remove(), mcl_list_remove_with_content(), mcl_list_reset(), mcl_log_util_set_callback(), mcl_random_generate_bytes(), mcl_random_generate_guid(), mcl_string_util_concatenate(), mcl_string_util_find(), mcl_string_util_find_case_insensitive(), mcl_string_util_memcmp(), mcl_string_util_memcpy(), mcl_string_util_memset(), mcl_string_util_reset(), mcl_string_util_snprintf(), mcl_string_util_strdup(), mcl_string_util_strlen(), mcl_string_util_strncat(), mcl_string_util_strncmp(), mcl_string_util_strncpy(), mcl_string_util_strnlen(), mcl_string_util_strtol(), mcl_time_util_convert_to_iso_8601_format(), mcl_time_util_validate_timestamp(), mcl_tls_ca_chain_add_certificate(), mcl_tls_ca_chain_destroy(), mcl_tls_ca_chain_init(), mcl_tls_socket_connect(), mcl_tls_socket_destroy(), mcl_tls_socket_init(), mcl_tls_socket_open(), mcl_tls_socket_set_parameter(), random_generate_guid(), random_generate_number(), receive_until_lf(), security_generate_random_bytes(), security_generate_rsa_key(), security_handler_base64_decode(), security_handler_base64_encode(), security_handler_base64_url_encode(), security_handler_destroy(), security_handler_generate_jti(), security_handler_generate_rsa_key(), security_handler_hash_sha256(), security_handler_hmac_sha256(), security_handler_initialize(), security_handler_rsa_sign(), security_hash_sha256(), security_initialize(), security_rsa_get_modulus_and_exponent(), security_rsa_sign(), send_header(), send_header_list(), send_with_callback(), start_http(), string_util_concatenate(), string_util_find(), string_util_find_case_insensitive(), string_util_memcmp(), string_util_memcpy(), string_util_memset(), string_util_reset(), string_util_snprintf(), string_util_strdup(), string_util_strlen(), string_util_strncat(), string_util_strncmp(), string_util_strncpy(), string_util_strnlen(), string_util_strtol(), and time_util_get_time().

#define MCL_DEBUG_LEAVE (   ...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_DEBUG, MCL_LOG_TAG_LEAVE, __VA_ARGS__)

Definition at line 116 of file mcl_log_util.h.

Referenced by _add_jwks(), _add_key_to_keys_array(), _add_schema_to_jwt(), _base64_encode_big_number(), _calculate_signature(), _certificate_list_destroy_callback(), _check_client_secret(), _check_rsa_private_key(), _compose_access_token_request_payload(), _compose_rsa_key_rotation_json(), _compose_rsa_onboarding_json(), _convert_to_mcl_return_code(), _create_self_issued_jwt_header(), _create_self_issued_jwt_payload(), _custom_load_register_info(), _decode_quantum(), _decode_with_table(), _encode_with_table(), _generate_correlation_id_string(), _generate_token(), _get_header_and_payload_encoded_base64_url(), _get_rsa_private_key(), _get_rsa_public_key(), _is_empty_line(), _join_with_dot(), _load_initial_credentials(), _print_formatted_string(), _process_registration_response(), _process_registration_response_rsa_3072(), _process_registration_response_shared_secret(), _request_payload_callback_for_put(), _response_header_callback(), _response_payload_callback(), _save_credentials(), _set_in_file_size(), _set_payload_options(), _set_request_options(), _ssl_context_callback(), base64_decode(), base64_encode(), base64_url_decode(), base64_url_encode(), core_configuration_log(), core_configuration_validate(), core_processor_destroy(), core_processor_get_access_token(), core_processor_initialize(), core_processor_register(), core_processor_update_credentials(), get_chunked_response(), get_content_length_response(), get_response(), hmac_sha256(), json_util_initialize_json_library(), jwt_destroy(), jwt_get_token(), jwt_initialize(), mcl_core_configuration_destroy(), mcl_core_configuration_initialize(), mcl_core_configuration_set_parameter(), mcl_core_destroy(), mcl_core_get_access_token(), mcl_core_get_client_id(), mcl_core_get_host_name(), mcl_core_get_http_client(), mcl_core_get_last_access_token(), mcl_core_get_last_token_time(), mcl_core_initialize(), mcl_core_is_onboarded(), mcl_core_onboard(), mcl_core_rotate_key(), mcl_core_update_credentials(), mcl_file_util_check_if_regular_file(), mcl_file_util_fclose(), mcl_file_util_fflush(), mcl_file_util_fgets(), mcl_file_util_fopen(), mcl_file_util_fputs(), mcl_file_util_fread(), mcl_file_util_fwrite(), mcl_file_util_get_file_size(), mcl_file_util_get_time_of_last_status_change(), mcl_file_util_rewind(), mcl_http_client_add_certificate(), mcl_http_client_destroy(), mcl_http_client_initialize(), mcl_http_client_send(), mcl_http_request_add_header(), mcl_http_request_destroy(), mcl_http_request_initialize(), mcl_http_request_set_parameter(), mcl_http_response_destroy(), mcl_http_response_get_header(), mcl_http_response_get_status(), mcl_http_response_initialize(), mcl_json_util_add_bool(), mcl_json_util_add_double(), mcl_json_util_add_item_to_array(), mcl_json_util_add_null(), mcl_json_util_add_object(), mcl_json_util_add_string(), mcl_json_util_add_uint(), mcl_json_util_destroy(), mcl_json_util_duplicate(), mcl_json_util_get_array_item(), mcl_json_util_get_array_size(), mcl_json_util_get_bool_value(), mcl_json_util_get_double_value(), mcl_json_util_get_number_value(), mcl_json_util_get_object_item(), mcl_json_util_get_string(), mcl_json_util_has_child(), mcl_json_util_initialize(), mcl_json_util_library_initialize(), mcl_json_util_parse(), mcl_json_util_start_array(), mcl_json_util_start_object(), mcl_json_util_to_string(), mcl_list_add(), mcl_list_destroy(), mcl_list_destroy_with_content(), mcl_list_exist(), mcl_list_initialize(), mcl_list_next(), mcl_list_remove(), mcl_list_remove_with_content(), mcl_list_reset(), mcl_log_util_set_callback(), mcl_random_generate_bytes(), mcl_random_generate_guid(), mcl_string_util_concatenate(), mcl_string_util_find(), mcl_string_util_find_case_insensitive(), mcl_string_util_memcmp(), mcl_string_util_memcpy(), mcl_string_util_memset(), mcl_string_util_reset(), mcl_string_util_snprintf(), mcl_string_util_strdup(), mcl_string_util_strlen(), mcl_string_util_strncat(), mcl_string_util_strncmp(), mcl_string_util_strncpy(), mcl_string_util_strnlen(), mcl_string_util_strtol(), mcl_time_util_convert_to_iso_8601_format(), mcl_time_util_validate_timestamp(), mcl_tls_ca_chain_add_certificate(), mcl_tls_ca_chain_destroy(), mcl_tls_ca_chain_init(), mcl_tls_socket_connect(), mcl_tls_socket_destroy(), mcl_tls_socket_init(), mcl_tls_socket_open(), mcl_tls_socket_set_parameter(), random_generate_guid(), random_generate_number(), receive_until_lf(), security_generate_random_bytes(), security_generate_rsa_key(), security_handler_base64_decode(), security_handler_base64_encode(), security_handler_base64_url_encode(), security_handler_destroy(), security_handler_generate_jti(), security_handler_generate_rsa_key(), security_handler_hash_sha256(), security_handler_hmac_sha256(), security_handler_initialize(), security_handler_rsa_sign(), security_hash_sha256(), security_initialize(), security_rsa_get_modulus_and_exponent(), security_rsa_sign(), send_header(), send_header_list(), send_with_callback(), start_http(), string_util_concatenate(), string_util_find(), string_util_find_case_insensitive(), string_util_memcmp(), string_util_memcpy(), string_util_memset(), string_util_reset(), string_util_snprintf(), string_util_strdup(), string_util_strlen(), string_util_strncat(), string_util_strncmp(), string_util_strncpy(), string_util_strnlen(), string_util_strtol(), and time_util_get_time().

#define MCL_DEBUG_STRING (   string)    MCL_DEBUG("%s", string)

Definition at line 117 of file mcl_log_util.h.

#define MCL_FATAL (   ...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_FATAL, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)

Definition at line 150 of file mcl_log_util.h.

#define MCL_FATAL_STRING (   string)    MCL_FATAL("%s", string)

Definition at line 151 of file mcl_log_util.h.

#define MCL_INFO_STRING (   string)    MCL_INFO("%s", string)

Definition at line 127 of file mcl_log_util.h.

#define MCL_LOG_DISABLED   (!MCL_LOG_ENABLED_COMPILE_TIME(MCL_LOG_LEVEL_FATAL))

Definition at line 82 of file mcl_log_util.h.

#define MCL_LOG_ENABLED_COMPILE_TIME (   level)    ((level) >= MCL_LOG_LEVEL)

Definition at line 80 of file mcl_log_util.h.

Referenced by mcl_tls_socket_init().

#define MCL_LOG_ENABLED_RUN_TIME (   level)    ((level) >= mcl_log_util_get_output_level())

Definition at line 81 of file mcl_log_util.h.

Referenced by mbedtls_debug_function().

#define MCL_LOG_TAG_DEFAULT   "[..]"

Definition at line 84 of file mcl_log_util.h.

#define MCL_LOG_TAG_ENTRY   "[->]"

Definition at line 85 of file mcl_log_util.h.

#define MCL_LOG_TAG_LEAVE   "[<-]"

Definition at line 86 of file mcl_log_util.h.

#define MCL_LOG_WRITE (   level,
  tag,
  ... 
)
Value:
do { \
mcl_log_util_function(mcl_log_util_user_context, level, __FILE__, __LINE__, tag, __VA_ARGS__); \
} while(0)
#define MCL_LOG_ENABLED_RUN_TIME(level)
Definition: mcl_log_util.h:81
MCL_CORE_EXPORT mcl_log_util_callback_t mcl_log_util_function
Definition: log_util.c:19
MCL_CORE_EXPORT void * mcl_log_util_user_context
Definition: log_util.c:20

Definition at line 94 of file mcl_log_util.h.

#define MCL_VERBOSE_STRING (   string)    MCL_VERBOSE("%s", string)

Definition at line 105 of file mcl_log_util.h.

#define MCL_WARN (   ...)    MCL_LOG_WRITE(MCL_LOG_LEVEL_WARN, MCL_LOG_TAG_DEFAULT, __VA_ARGS__)

Definition at line 134 of file mcl_log_util.h.

Referenced by _save_credentials().

#define MCL_WARN_STRING (   string)    MCL_WARN("%s", string)

Definition at line 135 of file mcl_log_util.h.

Typedef Documentation

typedef void(* mcl_log_util_callback_t) (void *user_context, int log_level, const char *file, int line, const char *tag, const char *const format,...)

Log utility callback function definition.

Parameters
[in]user_contextUser's own context.
[in]log_levelLog level.
[in]fileFile where log function is called.
[in]lineLine number.
[in]tagMessage tag.
[in]formatMessage format.

Definition at line 31 of file mcl_log_util.h.

Function Documentation

MCL_CORE_EXPORT int mcl_log_util_get_output_level ( void  )

This function is used to get log output level.

Returns
  • Output level of log utility.

Definition at line 51 of file log_util.c.

References _mcl_log_level, and MCL_LOG_LEVEL_NONE.

MCL_CORE_EXPORT mcl_error_t mcl_log_util_set_callback ( mcl_log_util_callback_t  callback,
void *  user_context 
)

This function is used to set callback function for log utility.

Parameters
[in]callbackCallback function.
[in]user_contextUser context argument.
Returns

Definition at line 60 of file log_util.c.

References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_FUNCTION_LEAVE_LABEL, mcl_log_util_function, mcl_log_util_user_context, and MCL_OK.

MCL_CORE_EXPORT mcl_error_t mcl_log_util_set_output_level ( const int  log_level)

This function sets the output level. The output level is used during runtime check. No logs are written if given log level is below this output level.

Parameters
[in]log_levelThe output level to set with. Following log levels can be set.
  • MCL_LOG_LEVEL_VERBOSE. //!< All other events.
  • MCL_LOG_LEVEL_DEBUG. //!< Minimal set of events that could help to reconstruct the execution path.
  • MCL_LOG_LEVEL_INFO. //!< Significant life cycle event or major state transition happened.
  • MCL_LOG_LEVEL_WARN. //!< Something that usually should not occur happened and significantly changes application behavior for some period of time.
  • MCL_LOG_LEVEL_ERROR. //!< Something possible, but highly unexpected happened. The process is able to recover and continue execution.
  • MCL_LOG_LEVEL_FATAL. //!< Something impossible and absolutely unexpected happened. Process can't continue and must be terminated.
  • MCL_LOG_LEVEL_NONE. //!< None.
Returns

Definition at line 33 of file log_util.c.

References _mcl_log_level, MCL_INVALID_LOG_LEVEL, MCL_LOG_LEVEL, MCL_LOG_LEVEL_FATAL, MCL_LOG_LEVEL_NONE, and MCL_OK.

Variable Documentation

Definition at line 19 of file log_util.c.

Referenced by mbedtls_debug_function(), and mcl_log_util_set_callback().

MCL_CORE_EXPORT void* mcl_log_util_user_context

Definition at line 20 of file log_util.c.

Referenced by mbedtls_debug_function(), and mcl_log_util_set_callback().