OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Logging

Detailed Description

The Logging Subsystem.

The logging system is made up of two parts. The upper layer provides message formatting, and discards log messages that are less than the current log level.

The bottom layer is the logging transport. This can be

The low level implementation is determined by the callback function passed to SysLog_Initialize (or via PIPELINE_LOG_WRITE).

To log messages to the console, use SysLog_Message() and SysLog_Print(). This should not be called within interrupt context.

Files

file  syslog.h
 The upper layer of the Logging subsystem.
 
file  usb_console.h
 A logging transport that uses a USB serial console.
 

Typedefs

typedef void(* SysLogWriteFn )(const char *)
 A function pointer to log a message. More...
 

Enumerations

enum  SysLogLevel {
  SYSLOG_DEBUG, SYSLOG_INFO, SYSLOG_WARN, SYSLOG_ERROR,
  SYSLOG_FATAL, SYSLOG_ALWAYS
}
 The system log levels. More...
 

Functions

void SysLog_Initialize (SysLogWriteFn write_fn)
 Initialize the System Logging module. More...
 
void SysLog_Message (SysLogLevel level, const char *msg)
 Log a message. More...
 
void SysLog_Print (SysLogLevel level, const char *format,...)
 Format and log a message. More...
 
SysLogLevel SysLog_GetLevel ()
 Return the current log level. More...
 
void SysLog_SetLevel (SysLogLevel level)
 Set the log level. More...
 
void SysLog_Increment ()
 Increase the verbosity of the logging.
 
void SysLog_Decrement ()
 Decrease the verbosity of the logging.
 
const char * SysLog_LevelToString (SysLogLevel level)
 Return the string description of a log level. More...
 
void USBConsole_Initialize ()
 Initialize the USB Console module.
 
void USBConsole_Log (const char *message)
 Write a message to the console. More...
 
void USBConsole_Tasks ()
 Perform the housekeeping tasks for the USB Console.
 

Typedef Documentation

typedef void(* SysLogWriteFn)(const char *)

A function pointer to log a message.

Parameters
msgThe message to log, must be NULL terminated.

Enumeration Type Documentation

The system log levels.

Enumerator
SYSLOG_DEBUG 

Debug messages.

SYSLOG_INFO 

Info messages.

SYSLOG_WARN 

Warnings.

SYSLOG_ERROR 

Errors.

SYSLOG_FATAL 

Fatal events.

SYSLOG_ALWAYS 

Always logged regardless of log level.

Function Documentation

SysLogLevel SysLog_GetLevel ( )

Return the current log level.

Returns
The current log level.
void SysLog_Initialize ( SysLogWriteFn  write_fn)

Initialize the System Logging module.

Parameters
write_fnThe function to use for logging messages.

If PIPELINE_LOG_WRITE is defined in app_pipeline.h, the macro will override the write_fn argument.

const char* SysLog_LevelToString ( SysLogLevel  level)

Return the string description of a log level.

Parameters
levelThe log level.
Returns
A statically allocated string which contains the text description of the log level.
void SysLog_Message ( SysLogLevel  level,
const char *  msg 
)

Log a message.

Parameters
levelthe log level of the message
msgthe message to log.
Note
This should not be called within interrupt context.
void SysLog_Print ( SysLogLevel  level,
const char *  format,
  ... 
)

Format and log a message.

Parameters
levelthe log level of the message
formatThe format string.
Note
This should not be called within interrupt context.
void SysLog_SetLevel ( SysLogLevel  level)

Set the log level.

Parameters
levelthe new log level.
void USBConsole_Log ( const char *  message)

Write a message to the console.

Parameters
messagea NULL terminated string.

We may not buffer the entire message if the log buffer is full. Since the messages are sent over a serial console, the NULL characters are replaced with
characters.