# Logging: Logging Class Reference

# Logging Class Reference

`#include <Logging.h>`

List of all members.

## Public Member Functions

| Logging ()
void | Init (int level, long baud)
void | Error (char *msg,...)
void | Info (char *msg,...)
void | Debug (char *msg,...)
void | Verbose (char *msg,...)

## Private Member Functions

void | print (const char *format, va_list args)

## Private Attributes

int | _level
long | _baud

## Detailed Description

Logging is a helper class to output informations over RS232. If you know log4j or log4net, this logging class is more or less similar ;-)
Different loglevels can be used to extend or reduce output All methods are able to handle any number of output parameters. All methods print out a formated string (like printf).
To reduce output and program size, reduce loglevel.
Output format string can contain below wildcards. Every wildcard must be start with percent sign (%)

Depending on loglevel, source code is excluded from compile !
Wildcards

- %s replace with an string (char*)
- %c replace with an character
- %d replace with an integer value
- %l replace with an long value
- %x replace and convert integer value into hex
- %X like x but combine with 0x123AB
- %b replace and convert integer value into binary
- %B like x but combine with 0b10100011
- %t replace and convert boolean value into "t" or "f"
- %T like t but convert into "true" or "false"

Loglevels

0 | LOG_LEVEL_NOOUTPUT | no output
1 | LOG_LEVEL_ERRORS | only errors
2 | LOG_LEVEL_INFOS | errors and info
3 | LOG_LEVEL_DEBUG | errors, info and debug
4 | LOG_LEVEL_VERBOSE | all

# History

01 FEB 2012 | initial release
06 MAR 2012 | implement a preinstanciate object (like in Wire, ...)
| methode init get now loglevel and baud parameter

Definition at line 71 of file Logging.h.

## Constructor & Destructor Documentation

Logging::Logging | ( |  | ) | `[inline]`

default Constructor

Definition at line 79 of file Logging.h.

## Member Function Documentation

void Logging::Init | ( | int | level,
|  | long | baud |
| ) |  |  |

Initializing, must be called as first.

Parameters:

  | void |

Returns:
  void

Definition at line 3 of file Logging.cpp.

References _baud, _level, LOG_LEVEL_NOOUTPUT, and LOG_LEVEL_VERBOSE.

void Logging::Error | ( | char * | msg,
|  |  | ... |
| ) |  |  |

Output an error message. Output message contains ERROR: followed by original msg Error messages are printed out, at every loglevel except 0 ;-)

Parameters:

  | msg | format string to output
  | ... | any number of variables

Returns:
  void

Definition at line 9 of file Logging.cpp.

References _level, LOG_LEVEL_ERRORS, and print().

Here is the call graph for this function:

void Logging::Info | ( | char * | msg,
|  |  | ... |
| ) |  |  |

Output an info message. Output message contains Info messages are printed out at l loglevels >= LOG_LEVEL_INFOS

Parameters:

  | msg | format string to output
  | ... | any number of variables

Returns:
  void

Definition at line 19 of file Logging.cpp.

References _level, LOG_LEVEL_INFOS, and print().

Here is the call graph for this function:

void Logging::Debug | ( | char * | msg,
|  |  | ... |
| ) |  |  |

Output an debug message. Output message contains Debug messages are printed out at l loglevels >= LOG_LEVEL_DEBUG

Parameters:

  | msg | format string to output
  | ... | any number of variables

Returns:
  void

Definition at line 27 of file Logging.cpp.

References _level, LOG_LEVEL_DEBUG, and print().

Here is the call graph for this function:

void Logging::Verbose | ( | char * | msg,
|  |  | ... |
| ) |  |  |

Output an verbose message. Output message contains Debug messages are printed out at l loglevels >= LOG_LEVEL_VERBOSE

Parameters:

  | msg | format string to output
  | ... | any number of variables

Returns:
  void

Definition at line 36 of file Logging.cpp.

References _level, LOG_LEVEL_VERBOSE, and print().

Here is the call graph for this function:

void Logging::print | ( | const char * | format,
|  | va_list | args |
| ) |  |  | `[private]`

Definition at line 46 of file Logging.cpp.

Referenced by Debug(), Error(), Info(), and Verbose().

## Member Data Documentation

int Logging::_level `[private]`

Definition at line 73 of file Logging.h.

Referenced by Debug(), Error(), Info(), Init(), and Verbose().

long Logging::_baud `[private]`

Definition at line 74 of file Logging.h.

Referenced by Init().

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

- K:/Projekte/robotic/arduino/arduino_1-0Patch/libraries/Logging/Logging.h
- K:/Projekte/robotic/arduino/arduino_1-0Patch/libraries/Logging/Logging.cpp