Back to index

nux  3.0.0
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
nux::logging::LoggerModules Class Reference
Collaboration diagram for nux::logging::LoggerModules:
Collaboration graph

List of all members.

Public Member Functions

LoggerModulePtr const & GetModule (std::string const &module)
void reset ()
std::string dump_logging_levels (std::string const &prefix)

Static Public Member Functions

static LoggerModulesInstance ()

Private Types

typedef std::map< std::string,

Private Member Functions

 LoggerModules ()

Private Attributes

ModuleMap modules_
LoggerModulePtr root_

Detailed Description

Definition at line 72 of file Logger.cpp.

Member Typedef Documentation

typedef std::map<std::string, LoggerModulePtr> nux::logging::LoggerModules::ModuleMap [private]

Definition at line 86 of file Logger.cpp.

Constructor & Destructor Documentation

Definition at line 204 of file Logger.cpp.

  : root_(new LoggerModule("", LoggerModulePtr()))
  // Make sure we have the root logger available.
  modules_.insert(ModuleMap::value_type("", root_));

Member Function Documentation

std::string nux::logging::LoggerModules::dump_logging_levels ( std::string const &  prefix)

Definition at line 247 of file Logger.cpp.

  std::ostringstream sout;
  bool first = true;
  for (ModuleMap::iterator i = modules_.begin(), end = modules_.end(); i != end; ++i)
    std::string const& module_name = i->first;
    LoggerModulePtr const& module = i->second;
    Level severity = module->GetLogLevel();
    if (severity == NotSpecified)
      continue; // Don't write out unspecified ones.
    if (first)
      first = false;
      sout << "\n";
    sout << prefix;
    if (module_name == "")
      sout << "<root>";
      sout << module_name;
    sout << " " << str_level(severity);
  return sout.str();

Here is the caller graph for this function:

LoggerModulePtr const & nux::logging::LoggerModules::GetModule ( std::string const &  module)

Definition at line 218 of file Logger.cpp.

  std::string lower_module = boost::to_lower_copy(module);
  ModuleMap::iterator i = modules_.find(lower_module);
  if (i != modules_.end())
    return i->second;

  // Make the new LoggerModule and its parents.
  // Split on '.'
  std::string::size_type idx = lower_module.rfind(".");
  LoggerModulePtr parent = root_;
  if (idx != std::string::npos) {
    parent = GetModule(lower_module.substr(0, idx));
  LoggerModulePtr logger(new LoggerModule(lower_module, parent));
  // std::map insert method returns a pair<iterator, bool> which seems
  // overly annoying to make a temporary of, so just return the const
  // reference pointed to by the interator.
  return modules_.insert(ModuleMap::value_type(lower_module, logger)).first->second;

Definition at line 212 of file Logger.cpp.

  static LoggerModules instance;
  return instance;

Here is the caller graph for this function:

Definition at line 239 of file Logger.cpp.

  for (ModuleMap::iterator i = modules_.begin(), end = modules_.end(); i != end; ++i)

Here is the caller graph for this function:

Member Data Documentation

Definition at line 87 of file Logger.cpp.

Definition at line 88 of file Logger.cpp.

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