4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
FSYS::Log Class Reference

Log class used for logging information about program execution. More...

#include <log.h>

+ Collaboration diagram for FSYS::Log:

Public Member Functions

 Log (std::string const &module)
 The Log constructor. More...
 
void fatal (std::string const &fatal, std::string const &file, int line)
 
void err (std::string const &err, std::string const &file, int line)
 
void warn (std::string const &warn, std::string const &file, int line)
 
void debug (std::string const &debug, std::string const &file, int line)
 
void info (std::string const &info, std::string const &file, int line)
 

Static Public Member Functions

static void fatal (std::string const &fatal)
 Static function to log messages about fatal incidents in the code. More...
 
static void err (std::string const &err)
 Static function to log messages about error conditions in the code. More...
 
static void warn (std::string const &warn)
 Static function to log warning messages from the code. More...
 
static void debug (std::string const &debug)
 Static function to log debug messages. More...
 
static void info (std::string const &info)
 Static function to log info messages. More...
 

Protected Attributes

void * me
 The me member is available for use for actuall implementations. More...
 

Detailed Description

You don't need to instantiate a log object to use the system, you can if you want to, but it is recommended that you use the macro system instead.

To just get a log line out:

#include "FSYS/log.h"
...
FSYS::Log::info("This is an info message");
...

The above will output something like:

Info: "This is an info message"

How ever, it is recomended to use the macro interface:

#include "FSYS/log.h"
DECLARE_LOG_MODULE("MyModuleName");
...
INFO("This is an info message");
...

As this will also output the modulename, filename, and line number:

Info: (MyModuleName)"This is an info message"@filepath(line number)

Other macros are:

  • FATAL(msg) - For fatal, non-recoverable errors (leads to program crash/closure)
  • ERR(msg) - For error messages, that are handled in one way or the other
  • WARN(msg) - For warnings/unexpected behavior
  • DEBUG(msg) - For debug messages, used during development
  • INFO(msg) - For info/convinient messages usefull for knowing the state of the program
Note
It is not possible to have multiple calls to DECLARE_LOG_MODULE in the same source file.

Constructor & Destructor Documentation

FSYS::Log::Log ( std::string const &  module)

The Log constructor takes a module name in, the form of a string, as argument, this string will be appended to all of the non-static log strings in the interface.

The same module name can be used across multiple source files, and it is possible to have multiple log objects/module names in the same source file (as long as you don't use the macros).

You don't need to instantiate the class if you only use the static functions in it.

Parameters
moduleThe

Member Function Documentation

void FSYS::Log::debug ( std::string const &  debug)
static
#include "PAL/Interface/log.h"
...
FSYS::Log::debug("This is a debug message");
...
Parameters
debugString reference to the debug message

+ Here is the caller graph for this function:

void FSYS::Log::err ( std::string const &  err)
static
#include "PAL/Interface/log.h"
...
FSYS::Log::err("This is a message about an error");
...
Parameters
errString reference to the error message that should be logged

+ Here is the caller graph for this function:

void FSYS::Log::fatal ( std::string const &  fatal)
static
#include "PAL/Interface/log.h"
...
FSYS::Log::fatal("This is a message about a fatal event");
...
Parameters
fatalString reference to the message that should be logged as fatal

+ Here is the caller graph for this function:

void FSYS::Log::info ( std::string const &  info)
static
#include "PAL/Interface/log.h"
...
FSYS::Log::debug("This is an info message");
...
Parameters
debugString reference to the info message

+ Here is the call graph for this function:

void FSYS::Log::warn ( std::string const &  warn)
static
#include "PAL/Interface/log.h"
...
FSYS::Log::warn("This is a warning message");
...
Parameters
warnString reference to the message that should be logged as a warning

+ Here is the caller graph for this function:

Member Data Documentation

void* FSYS::Log::me
protected

The me member is not part of the public interface of the Log class, it has been added in case any of the platform specific implementations of the Log class needs to store some kind of information in the object.


The documentation for this class was generated from the following files: