SurgSim::Framework::LoggerManager Class Reference

Class to safely handle access to a group of loggers, manipulate the global logging threshold, and fetch logger(s) from a global pool. More...

`#include <SurgSim/Framework/LoggerManager.h>`

## Public Member Functions

| LoggerManager ()
| Constructor. More...
| ~LoggerManager ()
| Destructor. More...
void | setDefaultOutput (std::shared_ptr< LogOutput > output)
| Sets/Changes default output. More...
std::shared_ptr< LogOutput > | getDefaultOutput () const
| Return the default output. More...
std::shared_ptr< Logger > | getDefaultLogger ()
| Gets the default logger. More...
std::shared_ptr< Logger > | getLogger (const std::string &name)
| Gets a logger with a given name, creates a new one if none exists or the logger has been deallocated. More...
void | setThreshold (int threshold)
| Sets a threshold for all loggers. More...
void | setThreshold (const std::string &path, int threshold)
| Sets a threshold for a subgroup of loggers, the group is chosen by finding all loggers whose pathname starts with the same string as the pathname given. More...
int | getThreshold () const
| Return the threshold used by all loggers. More...

## Private Member Functions

| LoggerManager (const LoggerManager &)
LoggerManager & | operator= (const LoggerManager &)

## Private Attributes

std::unordered_map< std::string, std::shared_ptr< Logger > > | m_loggers
| Keep track of all the loggers. More...
std::vector< std::pair< std::string, int > > | m_thresholds
| Keep track of subgroup thresholds. More...
std::shared_ptr< LogOutput > | m_defaultOutput
| Use for default output of the logger. More...
int | m_globalThreshold
| Threshold used by all loggers. More...
boost::mutex | m_mutex

## Detailed Description

Class to safely handle access to a group of loggers, manipulate the global logging threshold, and fetch logger(s) from a global pool.

## Constructor & Destructor Documentation

## LoggerManager() [1/2]

SurgSim::Framework::LoggerManager::LoggerManager | ( |  | ) |

Constructor.

## ~LoggerManager()

SurgSim::Framework::LoggerManager::~LoggerManager | ( |  | ) |

Destructor.

## LoggerManager() [2/2]

SurgSim::Framework::LoggerManager::LoggerManager | ( | const LoggerManager & |  | ) |

private

## Member Function Documentation

## getDefaultLogger()

std::shared_ptr< Logger > SurgSim::Framework::LoggerManager::getDefaultLogger | ( |  | ) |

Gets the default logger.

Returns
  The default logger.

## getDefaultOutput()

std::shared_ptr< LogOutput > SurgSim::Framework::LoggerManager::getDefaultOutput | ( |  | ) | const

Return the default output.

## getLogger()

std::shared_ptr< Logger > SurgSim::Framework::LoggerManager::getLogger | ( | const std::string & | name | ) |

Gets a logger with a given name, creates a new one if none exists or the logger has been deallocated.

Parameters

  name | The name.

Returns
  The logger.

## getThreshold()

int SurgSim::Framework::LoggerManager::getThreshold | ( |  | ) | const

Return the threshold used by all loggers.

Returns
  Threshold used by all the loggers.

## operator=()

LoggerManager& SurgSim::Framework::LoggerManager::operator= | ( | const LoggerManager & |  | ) |

private

## setDefaultOutput()

void SurgSim::Framework::LoggerManager::setDefaultOutput | ( | std::shared_ptr< LogOutput > | output | ) |

Sets/Changes default output.

Parameters

  output | The output class to be used.

## setThreshold() [1/2]

void SurgSim::Framework::LoggerManager::setThreshold | ( | int | threshold | ) |

Sets a threshold for all loggers.

Parameters

  threshold | The threshold.

## setThreshold() [2/2]

void SurgSim::Framework::LoggerManager::setThreshold | ( | const std::string & | path,
|  | int | threshold
| ) |  |

Sets a threshold for a subgroup of loggers, the group is chosen by finding all loggers whose pathname starts with the same string as the pathname given.

Parameters

  path | Full pathname of the file.
  threshold | The threshold to use for these loggers.

## Member Data Documentation

## m_defaultOutput

std::shared_ptr<LogOutput> SurgSim::Framework::LoggerManager::m_defaultOutput

private

Use for default output of the logger.

## m_globalThreshold

int SurgSim::Framework::LoggerManager::m_globalThreshold

private

Threshold used by all loggers.

## m_loggers

std::unordered_map<std::string, std::shared_ptr<Logger> > SurgSim::Framework::LoggerManager::m_loggers

private

Keep track of all the loggers.

## m_mutex

boost::mutex SurgSim::Framework::LoggerManager::m_mutex

private

## m_thresholds

std::vector<std::pair<std::string, int> > SurgSim::Framework::LoggerManager::m_thresholds

private

Keep track of subgroup thresholds.

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

- SurgSim/Framework/LoggerManager.h
- SurgSim/Framework/LoggerManager.cpp