claw::log_system Class Reference

A class implementing a logging system. More...

`#include <logger.hpp>`

## Public Types

typedef log_stream | stream_type
typedef std::list< stream_type * > | stream_list_type

## Public Member Functions

CLAW_LOGGER_EXPORT | log_system ()
| Default constructor.
CLAW_LOGGER_EXPORT | ~log_system ()
| Destructor.
CLAW_LOGGER_EXPORT void | clear ()
| Delete the streams.
CLAW_LOGGER_EXPORT void | merge (stream_type *s)
| Add an other output stream.
CLAW_LOGGER_EXPORT void | remove (const stream_type *s)
| Remove a stream.
CLAW_LOGGER_EXPORT void | set (stream_type *s)
| Set the output stream.
CLAW_LOGGER_EXPORT void | set_level (int lvl)
| Change the level of log.
CLAW_LOGGER_EXPORT void | set_level (const log_level &lvl)
| Change the level of log.
CLAW_LOGGER_EXPORT void | flush ()
| Flush all log streams.
template<typename T>
log_system & | operator<< (const T &that)
CLAW_LOGGER_EXPORT log_system & | operator<< (const log_level &that)
| Change the level of the next mesasges.
CLAW_LOGGER_EXPORT log_system & | operator<< (log_system &(*pf)(log_system &))
| Apply a stream modifier function to the log_system.

## Detailed Description

A class implementing a logging system.

Messages are sent to the log system. If the importance (level) of a message is lower or equal to a given threshold, the message is printed. Otherwise, it is ignored.

Message printing is managed by log_stream classes. The logger_system can contain several log_stream. None checking is done when adding a log_stream to see if it is already in the system.

Author
  Julien Jorge

Definition at line 71 of file logger.hpp.

## Member Typedef Documentation

## stream_list_type

typedef std::list<stream_type*> claw::log_system::stream_list_type

Definition at line 75 of file logger.hpp.

## stream_type

typedef log_stream claw::log_system::stream_type

Definition at line 74 of file logger.hpp.

## Constructor & Destructor Documentation

## log_system()

claw::log_system::log_system | ( |  | ) |

Default constructor.

The logger is initialized with a console logger.

Definition at line 46 of file logger.cpp.

Referenced by operator<<().

## ~log_system()

claw::log_system::~log_system | ( |  | ) |

Destructor.

Definition at line 56 of file logger.cpp.

References clear().

## Member Function Documentation

## clear()

void claw::log_system::clear | ( |  | ) |

Delete the streams.

Definition at line 65 of file logger.cpp.

Referenced by set(), and ~log_system().

## flush()

void claw::log_system::flush | ( |  | ) |

Flush all log streams.

Definition at line 135 of file logger.cpp.

## merge()

void claw::log_system::merge | ( | stream_type * | s | ) |

Add an other output stream.

Parameters

  s | Dynamicaly allocated logger_stream.

Definition at line 80 of file logger.cpp.

## operator<<() [1/2]

claw::log_system & claw::log_system::operator<< | ( | const log_level & | that | ) |

Change the level of the next mesasges.

Parameters

  that | The new level.

Definition at line 151 of file logger.cpp.

References claw::log_level::get(), and claw::log_level::get_string().

## operator<<() [2/2]

claw::log_system & claw::log_system::operator<< | ( | log_system &(* | pf )(log_system &) | ) |

Apply a stream modifier function to the log_system.

Parameters

  pf | The function to apply.

Definition at line 166 of file logger.cpp.

References log_system().

## remove()

void claw::log_system::remove | ( | const stream_type * | s | ) |

Remove a stream.

Parameters

  s | The stream to remove.

Remarks
  The search is done on the address of the pointer s.

Definition at line 91 of file logger.cpp.

## set()

void claw::log_system::set | ( | stream_type * | s | ) |

Set the output stream.

Parameters

  s | Dynamicaly allocated logger_stream.

Definition at line 105 of file logger.cpp.

References clear().

## set_level() [1/2]

void claw::log_system::set_level | ( | const log_level & | lvl | ) |

Change the level of log.

Parameters

  lvl | New level.

Definition at line 126 of file logger.cpp.

References claw::log_level::get().

## set_level() [2/2]

void claw::log_system::set_level | ( | int | lvl | ) |

Change the level of log.

Parameters

  lvl | New level.

Definition at line 116 of file logger.cpp.

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

- logger.hpp
- code/logger.cpp