LogCabin
Classes | Namespaces | Enumerations | Functions
include/LogCabin/Debug.h File Reference

This file is used to control how LogCabin's debug log (event log) messages are handled. More...

#include <cstdio>
#include <initializer_list>
#include <functional>
#include <ostream>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  LogCabin::Core::Debug::DebugMessage
 When LogCabin wants to print a log message, this is the information that gets included. More...

Namespaces

namespace  LogCabin
namespace  LogCabin::Core
namespace  LogCabin::Core::Debug

Enumerations

enum  LogCabin::Core::Debug::LogLevel {
  LogCabin::Core::Debug::SILENT,
  LogCabin::Core::Debug::ERROR,
  LogCabin::Core::Debug::WARNING,
  LogCabin::Core::Debug::NOTICE,
  LogCabin::Core::Debug::VERBOSE
}
 The levels of verbosity for log messages. More...

Functions

std::string LogCabin::Core::Debug::getLogFilename ()
 Return the filename given to the last successful call to setLogFilename(), or the empty string if none.
std::string LogCabin::Core::Debug::setLogFilename (const std::string &filename)
 Open the given file by name and append future debug log messages to it.
std::string LogCabin::Core::Debug::reopenLogFromFilename ()
 Called to rotate the log file.
FILE * LogCabin::Core::Debug::setLogFile (FILE *newFile)
 Change the file on which debug log messages are written.
std::function< void(DebugMessage)> LogCabin::Core::Debug::setLogHandler (std::function< void(DebugMessage)> newHandler)
 Accept log messages on the given callback instead of writing them to a file.
std::vector< std::pair
< std::string, std::string > > 
LogCabin::Core::Debug::getLogPolicy ()
 Return the current log policy (as set by a previous call to setLogPolicy).
void LogCabin::Core::Debug::setLogPolicy (const std::vector< std::pair< std::string, std::string >> &newPolicy)
 Specify the log messages that should be displayed for each filename.
void LogCabin::Core::Debug::setLogPolicy (const std::initializer_list< std::pair< std::string, std::string >> &newPolicy)
 See setLogPolicy.
std::vector< std::pair
< std::string, std::string > > 
LogCabin::Core::Debug::logPolicyFromString (const std::string &in)
 Build a log policy from its string representation.
std::string LogCabin::Core::Debug::logPolicyToString (const std::vector< std::pair< std::string, std::string >> &policy)
 Serialize a log policy into a string representation.

Detailed Description

This file is used to control how LogCabin's debug log (event log) messages are handled.

When used by client applications, this should be accessed as LogCabin::Client::Debug (the LogCabin::Core namespace is used internally in LogCabin).

Definition in file Debug.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines