- /* Now close FileLoggers, for those logstreams that neglected to properly free their stuff. */
- for (FileLogMap::iterator it = FileLogs.begin(); it != FileLogs.end(); ++it)
+void LogManager::AddLogTypes(const std::string &types, LogStream* l, bool autoclose)
+{
+ irc::spacesepstream css(types);
+ std::string tok;
+ std::vector<std::string> excludes;
+ while (css.GetToken(tok))
+ {
+ if (tok.empty())
+ {
+ continue;
+ }
+ if (tok.at(0) == '-')
+ {
+ /* Exclude! */
+ excludes.push_back(tok.substr(1));
+ }
+ else
+ {
+ AddLogType(tok, l, autoclose);
+ }
+ }
+ // Handle doing things like: USERINPUT USEROUTPUT -USERINPUT should be the same as saying just USEROUTPUT.
+ // (This is so modules could, for example, inject exclusions for logtypes they can't handle.)
+ for (std::vector<std::string>::iterator i = excludes.begin(); i != excludes.end(); ++i)
+ {
+ if (*i == "*")
+ {
+ /* -* == Exclude all. Why someone would do this, I dunno. */
+ DelLogStream(l);
+ return;
+ }
+ DelLogType(*i, l);
+ }
+ // Now if it's registered as a global, add the exclusions there too.
+ std::map<LogStream *, std::vector<std::string> >::iterator gi = GlobalLogStreams.find(l);
+ if (gi != GlobalLogStreams.end())