Skip to content

Oscar Software Framework Manual Logging Module

scs edited this page Jul 13, 2012 · 2 revisions

Go to Table of Contents.

Table of Contents

Logging Module (log)

Description

The logging module is in charge of logging messages to file and console. A log level can be set to ignore messages with less than the specified priority.

In the host implementation, a special log level SIMULATION exists, which logs messages to a separate simulation log and can be used to assemble simulation results. Normal log messages are logged in the file log, in the execution directory.

In the target implementation, the Linux syslogd daemon is used to log messages to file. The same daemon also logs kernel messages, which consequently appear in the same configurable log file. Additionally, Linux can be configured to rotate this log file, so that the total log size remains limited.

Target Hardware Resource

None.

Dependencies

None.

Usage

Following code segment demonstrates the usage of the bmp module. For the sake of simplicity, error checking as well as framework creation and destruction are neglected.

 OscLog(ERROR, "An error occured (%s)!\n", /* (2) */
 strerror(errno));
 
 OscDbg(("Debugging...\n")); /* (3) */
  1. Set the log level for the console and the log file. The standard path of the log file is /var/log/log on the camera and ./osc_log on the host.
  2. Log a message. In this case at the log level ERROR.
  3. Log a temporary message used for debugging. This is a macro redirecting to OSCLog with log level DEBUG, which is why it needs a second set of brackets around the arguments. This macro can be redefined on release of the application, removing all temporary debug messages from the binary.
Clone this wiki locally