|
|||
|
|||
|
#include <logger.h>
Inheritance diagram for LogManager:


Public Member Functions | |
| LogManager (InspIRCd *Instance) | |
| void | SetupNoFork () |
| Sets up the logstream for -nofork. | |
| void | AddLoggerRef (FileWriter *fw) |
| Adds a FileWriter instance to LogManager, or increments the reference count of an existing instance. | |
| void | DelLoggerRef (FileWriter *fw) |
| Indicates that a FileWriter reference has been removed. | |
| void | OpenFileLogs () |
| Opens all logfiles defined in the configuration file using <log method="file">. | |
| void | CloseLogs () |
| Removes all LogStreams, meaning they have to be readded for logging to continue. | |
| void | AddLogTypes (const std::string &type, LogStream *l, bool autoclose) |
| Adds a single LogStream to multiple logtypes. | |
| bool | AddLogType (const std::string &type, LogStream *l, bool autoclose) |
| Registers a new logstream into the logging core, so it can be called for future events It is not a good idea to mix values of autoclose for the same LogStream. | |
| void | DelLogStream (LogStream *l) |
| Removes a logstream from the core. | |
| bool | DelLogType (const std::string &type, LogStream *l) |
| Removes a LogStream from a single type. | |
| void | Log (const std::string &type, int loglevel, const std::string &msg) |
| Logs an event, sending it to all LogStreams registered for the type. | |
| void | Log (const std::string &type, int loglevel, const char *fmt,...) CUSTOM_PRINTF(4 |
| Logs an event, sending it to all LogStreams registered for the type. | |
Private Attributes | |
| bool | Logging |
| Lock variable, set to true when a log is in progress, which prevents further loggging from happening and creating a loop. | |
| LogStream * | noforkstream |
| LogStream for -nofork, logs to STDOUT when it's active. | |
| InspIRCd * | ServerInstance |
| std::map< std::string, std::vector< LogStream * > > | LogStreams |
| Map of active log types and what LogStreams will receive them. | |
| std::map< LogStream *, int > | AllLogStreams |
| Refcount map of all LogStreams managed by LogManager. | |
| std::map< LogStream *, std::vector< std::string > > | GlobalLogStreams |
| LogStreams with type * (which means everything), and a list a logtypes they are excluded from (eg for "* -USERINPUT -USEROUTPUT"). | |
| FileLogMap | FileLogs |
| Refcounted map of all FileWriters in use by FileLogStreams, for file stream sharing. | |
Definition at line 126 of file logger.h.
|
|
Definition at line 158 of file logger.h. References ServerInstance. |
|
|
Adds a FileWriter instance to LogManager, or increments the reference count of an existing instance. Used for file-stream sharing for FileLogStreams. Definition at line 174 of file logger.h. Referenced by FileLogStream::FileLogStream(). |
|
||||||||||||||||
|
Registers a new logstream into the logging core, so it can be called for future events It is not a good idea to mix values of autoclose for the same LogStream.
Definition at line 176 of file logger.cpp. References AllLogStreams, GlobalLogStreams, and LogStreams. Referenced by AddLogTypes(), InspIRCd::OpenLog(), and SetupNoFork(). |
|
||||||||||||||||
|
Adds a single LogStream to multiple logtypes. This automatically handles things like "* -USERINPUT -USEROUTPUT" to mean all but USERINPUT and USEROUTPUT types. It is not a good idea to mix values of autoclose for the same LogStream.
Definition at line 135 of file logger.cpp. References AddLogType(), DelLogStream(), DelLogType(), irc::sepstream::GetToken(), and GlobalLogStreams. Referenced by OpenFileLogs(). |
|
|
Removes all LogStreams, meaning they have to be readded for logging to continue. Only LogStreams that were listed in AllLogStreams are actually closed. Definition at line 124 of file logger.cpp. References AllLogStreams, GlobalLogStreams, and LogStreams. Referenced by InspIRCd::Cleanup(), and ServerConfig::Read(). |
|
|
Indicates that a FileWriter reference has been removed. Reference count is decreased, and if zeroed, the FileWriter is closed. Definition at line 189 of file logger.h. Referenced by FileLogStream::~FileLogStream(). |
|
|
Removes a logstream from the core. After removal, it will not recieve further events. If the LogStream was ever added with autoclose, it will be closed after this call (this means the pointer won't be valid anymore). Definition at line 212 of file logger.cpp. References AllLogStreams, GlobalLogStreams, and LogStreams. Referenced by AddLogTypes(). |
|
||||||||||||
|
Removes a LogStream from a single type. If the LogStream has been registered for "*" it will still receive the type unless you remove it from "*" specifically. If the LogStream was added with autoclose set to true, then when the last occurrence of the stream is removed it will automatically be closed (freed). Definition at line 238 of file logger.cpp. References AllLogStreams, GlobalLogStreams, and LogStreams. Referenced by AddLogTypes(). |
|
||||||||||||||||||||
|
Logs an event, sending it to all LogStreams registered for the type.
Definition at line 284 of file logger.cpp. |
|
||||||||||||||||
|
|
Opens all logfiles defined in the configuration file using <log method="file">.
Definition at line 61 of file logger.cpp. References AddLogTypes(), Conf, InspIRCd::Config, DEBUG, ServerConfig::debugging, DEFAULT, ServerConfig::forcedebug, ServerConfig::nofork, NONE, ConfigReader::ReadValue(), ServerInstance, SetupNoFork(), SPARSE, VERBOSE, and ServerConfig::writelog. Referenced by ServerConfig::Read(). |
|
|
Sets up the logstream for -nofork. Called by InspIRCd::OpenLog() and LogManager::OpenFileLogs(). First time called it creates the nofork stream and stores it in noforkstream. Each call thereafter just readds it to GlobalLogStreams and updates the loglevel. Definition at line 47 of file logger.cpp. References AddLogType(), LogStream::ChangeLevel(), InspIRCd::Config, DEBUG, DEFAULT, ServerConfig::forcedebug, noforkstream, and ServerInstance. Referenced by OpenFileLogs(), and InspIRCd::OpenLog(). |
|
|
Refcount map of all LogStreams managed by LogManager. If a logstream is not listed here, it won't be automatically closed by LogManager, even if it's loaded in one of the other lists. Definition at line 146 of file logger.h. Referenced by AddLogType(), CloseLogs(), DelLogStream(), and DelLogType(). |
|
|
Refcounted map of all FileWriters in use by FileLogStreams, for file stream sharing.
|
|
|
LogStreams with type * (which means everything), and a list a logtypes they are excluded from (eg for "* -USERINPUT -USEROUTPUT").
Definition at line 150 of file logger.h. Referenced by AddLogType(), AddLogTypes(), CloseLogs(), DelLogStream(), DelLogType(), and Log(). |
|
|
Lock variable, set to true when a log is in progress, which prevents further loggging from happening and creating a loop.
Definition at line 131 of file logger.h. Referenced by Log(). |
|
|
Map of active log types and what LogStreams will receive them.
Definition at line 141 of file logger.h. Referenced by AddLogType(), CloseLogs(), DelLogStream(), DelLogType(), and Log(). |
|
|
LogStream for -nofork, logs to STDOUT when it's active.
Definition at line 135 of file logger.h. Referenced by SetupNoFork(). |
|
|
Definition at line 137 of file logger.h. Referenced by OpenFileLogs(), and SetupNoFork(). |