file_logger.c File Reference
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <stdarg.h>#include <stdint.h>#include <stdbool.h>#include "FreeRTOS.h"#include "queue.h"#include "task.h"#include "file_logger.h"#include "lpc_sys.h"#include "rtc.h"#include "ff.h"
Include dependency graph for file_logger.c:

Functions | |
| void | logger_send_flush_request (void) |
| uint32_t | logger_get_logged_call_count (logger_msg_t severity) |
| uint16_t | logger_get_blocked_call_count (void) |
| uint16_t | logger_get_highest_file_write_time_ms (void) |
| uint16_t | logger_get_num_buffers_watermark (void) |
| void | logger_init (uint8_t logger_priority) |
| void | logger_set_printf (logger_msg_t type, bool enable) |
| void | logger_log (logger_msg_t type, const char *filename, const char *func_name, unsigned line_num, const char *msg,...) |
| void | logger_log_raw (const char *msg,...) |
Function Documentation
| uint16_t logger_get_blocked_call_count | ( | void | ) |
- Returns
- the number of logging calls that ended up blocking or sleeping the task waiting for a logger buffer to be available.
If the number is greater than zero, it indicates that you either need to slow down logger calls, or increase the number of log buffers.
| uint16_t logger_get_highest_file_write_time_ms | ( | void | ) |
- Returns
- the highest time that was spend writing the logger buffer to file. This can be useful to assess how many FILE_LOGGER_NUM_BUFFERS we need because we only need enough buffers available while the file buffer is being written.
| uint32_t logger_get_logged_call_count | ( | logger_msg_t | severity | ) |
- Returns
- the number of logged messages for the given severity.
- Parameters
-
[in] severity The severity for which to get the number of calls.
| uint16_t logger_get_num_buffers_watermark | ( | void | ) |
- Returns
- the highest watermark of the number of buffers available to the logger This can be useful to assess how many FILE_LOGGER_NUM_BUFFERS we need in the worst case.
| void logger_init | ( | uint8_t | logger_priority | ) |
Initializes the logger; this must be done before further logging calls are used.
- Parameters
-
[in] logger_priority The priority at which logger should buffer user data and then write to file.
| void logger_log | ( | logger_msg_t | type, |
| const char * | filename, | ||
| const char * | func_name, | ||
| unsigned | line_num, | ||
| const char * | msg, | ||
| ... | |||
| ) |
Logs a message. You should not use this directly, the macros pass the arguments to this function.
| void logger_log_raw | ( | const char * | msg, |
| ... | |||
| ) |
- See also
- LOG_RAW_MSG() You should not use this directly, the macros pass the arguments to this function.
| void logger_send_flush_request | ( | void | ) |
Flushes the cached log data to the file
- Postcondition
- This will send a special request on the logger queue to flush the data, so the actual flushing will finish by the logger task at a later time.
- Note
- Flushing is not needed when the OS is running.
| void logger_set_printf | ( | logger_msg_t | type, |
| bool | enable | ||
| ) |
Enables the given logging severity call to be also printed on printf()
- Parameters
-
[in] type The severity for which the logging call will be printed [in] enable If true, the severity level will also get printed to the screen
Note that if a lot of data is being printed, the logger call may take a while until the stdio printf() returns back.

1.8.11