Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Group_logging_func

Group_logging_func

A logging subsystem provides a set of helper functions to manage logging in the application. More...

Functions

cy_rslt_t cy_log_init (CY_LOG_LEVEL_T level, log_output platform_output, platform_get_time platform_time)
 Initialize the logging subsystem.
cy_rslt_t cy_log_shutdown (void)
 Shutdown the logging subsystem.
cy_rslt_t cy_log_set_platform_output (log_output platform_output)
 Set the platform output routine for log messages.
cy_rslt_t cy_log_set_platform_time (platform_get_time platform_time)
 Set the platform routine for getting time stamps for log messages.
cy_rslt_t cy_log_set_facility_level (CY_LOG_FACILITY_T facility, CY_LOG_LEVEL_T level)
 Set the logging level for a facility.
cy_rslt_t cy_log_set_all_levels (CY_LOG_LEVEL_T level)
 Set the logging level for all facilities.
CY_LOG_LEVEL_T cy_log_get_facility_level (CY_LOG_FACILITY_T facility)
 Get the logging level for a facility.
cy_rslt_t cy_log_msg (CY_LOG_FACILITY_T facility, CY_LOG_LEVEL_T level, const char *fmt,...)
 Write a log message.
cy_rslt_t cy_log_printf (const char *fmt,...)
 Write a log message bypassing the log level check.
cy_rslt_t cy_log_vprintf (const char *fmt, va_list varg)
 Write a log message bypassing the log level check using va_list.

Detailed Description

A logging subsystem provides a set of helper functions to manage logging in the application.


Function Documentation

CY_LOG_LEVEL_T cy_log_get_facility_level ( CY_LOG_FACILITY_T  facility )

Get the logging level for a facility.

Parameters:
[in]facility: The facility for which to return the log level.
Returns:
The current log level.

Definition at line 279 of file cy_log.c.

cy_rslt_t cy_log_init ( CY_LOG_LEVEL_T  level,
log_output  platform_output,
platform_get_time  platform_time 
)

Initialize the logging subsystem.

Parameters:
[in]level: The initial logging level to use for all facilities.
[in]platform_output: Pointer to the function invoked by the library to output the log messages. If this argument is passed as NULL, the library prints the log output on the standard output stream (stdio).
[in]platform_time: Pointer to the function invoked by the library to get the time. If this argument is passed as NULL, the library calls [cy_rtos_get_time](https://cypresssemiconductorco.github.io/abstraction-rtos/html/group__group__abstraction__rtos__time.html) function to get the time required for logging.
Returns:
cy_rslt_t

Definition at line 125 of file cy_log.c.

cy_rslt_t cy_log_msg ( CY_LOG_FACILITY_T  facility,
CY_LOG_LEVEL_T  level,
const char *  fmt,
  ... 
)

Write a log message.

Note:
The format arguments are the same as for printf.
Parameters:
[in]facility: The facility for the log message.
[in]level: Log level of the message.
[in]fmt: Format control string followed by any optional arguments.
Returns:
cy_rslt_t

Definition at line 299 of file cy_log.c.

cy_rslt_t cy_log_printf ( const char *  fmt,
  ... 
)

Write a log message bypassing the log level check.

Note:
The format arguments are the same as for printf.
Parameters:
[in]fmt: Format control string followed by any optional arguments.
Returns:
cy_rslt_t

Definition at line 382 of file cy_log.c.

cy_rslt_t cy_log_set_all_levels ( CY_LOG_LEVEL_T  level )

Set the logging level for all facilities.

Parameters:
[in]level: The new log level to use.
Returns:
cy_rslt_t

Definition at line 256 of file cy_log.c.

cy_rslt_t cy_log_set_facility_level ( CY_LOG_FACILITY_T  facility,
CY_LOG_LEVEL_T  level 
)

Set the logging level for a facility.

Parameters:
[in]facility: The facility for which to set the log level.
[in]level: The new log level to use.
Returns:
cy_rslt_t

Definition at line 234 of file cy_log.c.

cy_rslt_t cy_log_set_platform_output ( log_output  platform_output )

Set the platform output routine for log messages.

Note:
If platform_output is NULL, log messages will be discarded.
Parameters:
[in]platform_output: Pointer to the platform output routine for log messages.
Returns:
cy_rslt_t

Definition at line 209 of file cy_log.c.

cy_rslt_t cy_log_set_platform_time ( platform_get_time  platform_time )

Set the platform routine for getting time stamps for log messages.

Note:
If platform_time is NULL, cy_time_get_time() is used for time stamps.
Parameters:
[in]platform_time: Pointer to a platform time routine for log message time stamps.
Returns:
cy_rslt_t

Definition at line 222 of file cy_log.c.

cy_rslt_t cy_log_shutdown ( void   )

Shutdown the logging subsystem.

Returns:
cy_rslt_t

Definition at line 195 of file cy_log.c.

cy_rslt_t cy_log_vprintf ( const char *  fmt,
va_list  varg 
)

Write a log message bypassing the log level check using va_list.

Note:
The format arguments are the same as for vprintf.
Parameters:
[in]fmt: Format control string.
[in]varg: va_list of arguments.
Returns:
cy_rslt_t

Definition at line 394 of file cy_log.c.