Browse Source

RenX_ExtraLogging:

* Added time to newDayFmt.
* newDayFmt is now printed to the log file on init().
* Removed erroneous call to init() in constructor
pull/3/head
JustinAJ 10 years ago
parent
commit
c9aad25977
  1. 11
      RenX.ExtraLogging/RenX_ExtraLogging.cpp

11
RenX.ExtraLogging/RenX_ExtraLogging.cpp

@ -24,7 +24,6 @@
RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin() RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin()
{ {
RenX_ExtraLoggingPlugin::day = localtime(std::addressof<const time_t>(time(nullptr)))->tm_yday; RenX_ExtraLoggingPlugin::day = localtime(std::addressof<const time_t>(time(nullptr)))->tm_yday;
RenX_ExtraLoggingPlugin::init();
} }
RenX_ExtraLoggingPlugin::~RenX_ExtraLoggingPlugin() RenX_ExtraLoggingPlugin::~RenX_ExtraLoggingPlugin()
@ -44,7 +43,7 @@ bool RenX_ExtraLoggingPlugin::init()
{ {
RenX_ExtraLoggingPlugin::filePrefix = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("FilePrefix"), Jupiter::StringS::Format("[%.*s] %.*s", RenX::tags->timeTag.size(), RenX::tags->timeTag.ptr(), RenX::tags->serverPrefixTag.size(), RenX::tags->serverPrefixTag.ptr())); RenX_ExtraLoggingPlugin::filePrefix = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("FilePrefix"), Jupiter::StringS::Format("[%.*s] %.*s", RenX::tags->timeTag.size(), RenX::tags->timeTag.ptr(), RenX::tags->serverPrefixTag.size(), RenX::tags->serverPrefixTag.ptr()));
RenX_ExtraLoggingPlugin::consolePrefix = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("ConsolePrefix"), RenX_ExtraLoggingPlugin::filePrefix); RenX_ExtraLoggingPlugin::consolePrefix = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("ConsolePrefix"), RenX_ExtraLoggingPlugin::filePrefix);
RenX_ExtraLoggingPlugin::newDayFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("NewDayFormat"), Jupiter::StringS::Format("Time: %.*s", RenX::tags->dateTag.size(), RenX::tags->dateTag.ptr())); RenX_ExtraLoggingPlugin::newDayFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("NewDayFormat"), Jupiter::StringS::Format("Time: %.*s %.*s", RenX::tags->timeTag.size(), RenX::tags->timeTag.ptr(), RenX::tags->dateTag.size(), RenX::tags->dateTag.ptr()));
RenX_ExtraLoggingPlugin::printToConsole = Jupiter::IRC::Client::Config->getBool(this->getName(), STRING_LITERAL_AS_REFERENCE("PrintToConsole"), true); RenX_ExtraLoggingPlugin::printToConsole = Jupiter::IRC::Client::Config->getBool(this->getName(), STRING_LITERAL_AS_REFERENCE("PrintToConsole"), true);
const Jupiter::CStringS logFile = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("LogFile")); const Jupiter::CStringS logFile = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("LogFile"));
@ -53,7 +52,15 @@ bool RenX_ExtraLoggingPlugin::init()
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::newDayFmt); RenX::sanitizeTags(RenX_ExtraLoggingPlugin::newDayFmt);
if (logFile.isNotEmpty()) if (logFile.isNotEmpty())
{
RenX_ExtraLoggingPlugin::file = fopen(logFile.c_str(), "a+b"); RenX_ExtraLoggingPlugin::file = fopen(logFile.c_str(), "a+b");
if (RenX_ExtraLoggingPlugin::file != nullptr && RenX_ExtraLoggingPlugin::newDayFmt.isNotEmpty())
{
Jupiter::String line = RenX_ExtraLoggingPlugin::newDayFmt;
RenX::processTags(line);
line.println(RenX_ExtraLoggingPlugin::file);
}
}
else else
RenX_ExtraLoggingPlugin::file = nullptr; RenX_ExtraLoggingPlugin::file = nullptr;

Loading…
Cancel
Save