OPTIGA™ Trust M
Host Library Documentation
optiga_lib_logger.h File Reference

This file provides the prototypes for the OPTIGA library logger. More...

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

Go to the source code of this file.

#define OPTIGA_UTIL_SERVICE   "[optiga util] : "
 
#define OPTIGA_CRYPT_SERVICE   "[optiga crypt] : "
 
#define OPTIGA_COMMAND_LAYER   "[optiga cmd] : "
 
#define OPTIGA_COMMUNICATION_LAYER   "[optiga comms] : "
 
#define OPTIGA_LIB_LOGGER_COLOR_RED   "\x1b[31m"
 
#define OPTIGA_LIB_LOGGER_COLOR_GREEN   "\x1b[32m"
 
#define OPTIGA_LIB_LOGGER_COLOR_YELLOW   "\x1b[33m"
 
#define OPTIGA_LIB_LOGGER_COLOR_BLUE   "\x1b[34m"
 
#define OPTIGA_LIB_LOGGER_COLOR_MAGENTA   "\x1b[35m"
 
#define OPTIGA_LIB_LOGGER_COLOR_CYAN   "\x1b[36m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY   "\x1b[90m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED   "\x1b[91m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN   "\x1b[92m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW   "\x1b[93m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE   "\x1b[94m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA   "\x1b[95m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN   "\x1b[96m"
 
#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT   "\x1b[0m"
 
#define OPTIGA_UTIL_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_CRYPT_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_COMMAND_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_COMMUNICATION_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_ERROR_COLOR   OPTIGA_LIB_LOGGER_COLOR_RED
 
#define OPTIGA_UNPROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN
 
#define OPTIGA_PROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_YELLOW
 
#define OPTIGA_HEX_BYTE_SEPERATOR   ""
 
#define OPTIGA_LIB_LOGGER_PRINT_ARRAY(p_output_buffer, p_temp_buffer, p_color)
 Converts the input array buffer to encode the color specified. More...
 
#define OPTIGA_LIB_LOGGER_PRINT_INFO(p_output_buffer, p_temp_buffer, p_layer, p_color)
 Converts the input string to encode the color specified. More...
 
void optiga_lib_print_string (const char_t *input_string)
 To log a string. More...
 
void optiga_lib_print_string_with_newline (const char_t *p_log_string)
 To log a string with a new line. More...
 
void optiga_lib_print_message (const char_t *p_log_string, const char_t *p_log_layer, const char_t *p_log_color)
 To log a string with a new line and layer information. More...
 
void optiga_lib_print_status (const char_t *p_log_layer, const char_t *p_log_color, uint16_t return_value)
 To log a return value with a new line and layer information. More...
 
void optiga_lib_print_array_hex_format (const uint8_t *p_log_string, uint16_t length, const char_t *p_log_color)
 To log the byte array in hex format. More...
 

Detailed Description

This file provides the prototypes for the OPTIGA library logger.

Author
Infineon Technologies AG

Definition in file optiga_lib_logger.h.

Macro Definition Documentation

◆ OPTIGA_COMMAND_LAYER

#define OPTIGA_COMMAND_LAYER   "[optiga cmd] : "

Definition at line 50 of file optiga_lib_logger.h.

◆ OPTIGA_COMMAND_LAYER_COLOR

#define OPTIGA_COMMAND_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Definition at line 73 of file optiga_lib_logger.h.

◆ OPTIGA_COMMUNICATION_LAYER

#define OPTIGA_COMMUNICATION_LAYER   "[optiga comms] : "

Definition at line 51 of file optiga_lib_logger.h.

◆ OPTIGA_COMMUNICATION_LAYER_COLOR

#define OPTIGA_COMMUNICATION_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Definition at line 74 of file optiga_lib_logger.h.

◆ OPTIGA_CRYPT_SERVICE

#define OPTIGA_CRYPT_SERVICE   "[optiga crypt] : "

Definition at line 49 of file optiga_lib_logger.h.

◆ OPTIGA_CRYPT_SERVICE_COLOR

#define OPTIGA_CRYPT_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Definition at line 72 of file optiga_lib_logger.h.

◆ OPTIGA_ERROR_COLOR

#define OPTIGA_ERROR_COLOR   OPTIGA_LIB_LOGGER_COLOR_RED

Definition at line 75 of file optiga_lib_logger.h.

◆ OPTIGA_HEX_BYTE_SEPERATOR

#define OPTIGA_HEX_BYTE_SEPERATOR   ""

Definition at line 79 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_BLUE

#define OPTIGA_LIB_LOGGER_COLOR_BLUE   "\x1b[34m"

Definition at line 58 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_CYAN

#define OPTIGA_LIB_LOGGER_COLOR_CYAN   "\x1b[36m"

Definition at line 60 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_DEFAULT

#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT   "\x1b[0m"

Definition at line 68 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_GREEN

#define OPTIGA_LIB_LOGGER_COLOR_GREEN   "\x1b[32m"

Definition at line 56 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE   "\x1b[94m"

Definition at line 65 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN   "\x1b[96m"

Definition at line 67 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN   "\x1b[92m"

Definition at line 63 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY   "\x1b[90m"

Definition at line 61 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA   "\x1b[95m"

Definition at line 66 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED   "\x1b[91m"

Definition at line 62 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW   "\x1b[93m"

Definition at line 64 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_MAGENTA

#define OPTIGA_LIB_LOGGER_COLOR_MAGENTA   "\x1b[35m"

Definition at line 59 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_RED

#define OPTIGA_LIB_LOGGER_COLOR_RED   "\x1b[31m"

Definition at line 55 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_COLOR_YELLOW

#define OPTIGA_LIB_LOGGER_COLOR_YELLOW   "\x1b[33m"

Definition at line 57 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_PRINT_ARRAY

#define OPTIGA_LIB_LOGGER_PRINT_ARRAY (   p_output_buffer,
  p_temp_buffer,
  p_color 
)
Value:
{ \
sprintf((char_t *)p_output_buffer, \
"%25s%s%s", \
p_color, \
p_temp_buffer, \
}

Converts the input array buffer to encode the color specified.

Converts the input array buffer to encode the color specified

Precondition
  • None
Note
  • None
Parameters
[out]p_output_bufferPointer to output buffer
[in]p_temp_bufferPointer to the input array buffer
[in]p_colorPointer to the color of array string

Definition at line 197 of file optiga_lib_logger.h.

◆ OPTIGA_LIB_LOGGER_PRINT_INFO

#define OPTIGA_LIB_LOGGER_PRINT_INFO (   p_output_buffer,
  p_temp_buffer,
  p_layer,
  p_color 
)
Value:
{ \
sprintf((char_t *)p_output_buffer, \
"%s%s%s%s", \
p_color, \
p_layer, \
p_temp_buffer, \
}

Converts the input string to encode the color specified.

Converts the input string to encode the color specified

Precondition
  • None
Note
  • None
Parameters
[out]p_output_bufferPointer to output buffer
[in]p_temp_bufferPointer to the input array buffer
[in]p_layerPointer to the layer info buffer
[in]p_colorPointer to the color of array string

Definition at line 223 of file optiga_lib_logger.h.

◆ OPTIGA_PROTECTED_DATA_COLOR

#define OPTIGA_PROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_YELLOW

Definition at line 77 of file optiga_lib_logger.h.

◆ OPTIGA_UNPROTECTED_DATA_COLOR

#define OPTIGA_UNPROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN

Definition at line 76 of file optiga_lib_logger.h.

◆ OPTIGA_UTIL_SERVICE

#define OPTIGA_UTIL_SERVICE   "[optiga util] : "

Definition at line 48 of file optiga_lib_logger.h.

◆ OPTIGA_UTIL_SERVICE_COLOR

#define OPTIGA_UTIL_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Definition at line 71 of file optiga_lib_logger.h.

Function Documentation

◆ optiga_lib_print_array_hex_format()

void optiga_lib_print_array_hex_format ( const uint8_t *  p_log_string,
uint16_t  length,
const char_t p_log_color 
)

To log the byte array in hex format.

To log the byte array in hex format

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the array string
[in]lengthLength of the array buffer
[in]p_log_colorPointer to the color of array string

◆ optiga_lib_print_message()

void optiga_lib_print_message ( const char_t p_log_string,
const char_t p_log_layer,
const char_t p_log_color 
)

To log a string with a new line and layer information.

To log a string with information of the layer from which it is invoked and with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string

◆ optiga_lib_print_status()

void optiga_lib_print_status ( const char_t p_log_layer,
const char_t p_log_color,
uint16_t  return_value 
)

To log a return value with a new line and layer information.

To log a if the return value was successful or not along with layer information

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string
[in]return_valueReturn value from the invoked layer

◆ optiga_lib_print_string()

void optiga_lib_print_string ( const char_t input_string)

To log a string.

To log a string.

  • Precondition
  • None
Note
  • None
Parameters
[in]input_stringPointer to the log string

◆ optiga_lib_print_string_with_newline()

void optiga_lib_print_string_with_newline ( const char_t p_log_string)

To log a string with a new line.

To log a string with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
OPTIGA_LIB_LOGGER_COLOR_DEFAULT
#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT
Definition: optiga_lib_logger.h:68
char_t
char char_t
Typedef for one byte integer.
Definition: optiga_lib_types.h:75