Skip to content

Error Logging

Colin Chan edited this page Jun 6, 2018 · 3 revisions

Logging Queue Intro

The logging queue is intended for brief error logs, equivalent to an error code.

Adding item to logging queue

To log to file, first use addLogItem() to add an item to xLoggingQueue. The arguments are:

  • LogType_t - enum that specifies type of log
  • EncodedMessage_t - enum that encodes details with associated LogType_t

Enums are defined in "sfu_task_logging.h"

A reference document is available here: https://docs.google.com/document/d/1VdZ2ZLdfByL5thwYg4ggyNYvPFjmcHge-LwsazGSZjg/edit?usp=sharing

The method addLogItem() also automatically timestamps when an item is added.

Example:

#include "sfu_task_logging.h"

addLogItem(logtype_1, details_1);

xLoggingQueue

The number of items that the queue accepts is limited by LOGGING_QUEUE_LENGTH in sfu_task_logging.h. It is currently 20.

If the queue is full, addLogItem() returns errQUEUE_FULL and will not log the current item.

Logging to file system

The task vLogToFileTask is started in sfu_task_main.c to automatically receive items from xLoggingQueue. When the task finds an item available, it is received from the queue and logged into the filesystem.