|
|
@ -24,7 +24,6 @@ |
|
|
|
RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin() |
|
|
|
{ |
|
|
|
RenX_ExtraLoggingPlugin::day = localtime(std::addressof<const time_t>(time(nullptr)))->tm_yday; |
|
|
|
RenX_ExtraLoggingPlugin::init(); |
|
|
|
} |
|
|
|
|
|
|
|
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::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); |
|
|
|
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); |
|
|
|
|
|
|
|
if (logFile.isNotEmpty()) |
|
|
|
{ |
|
|
|
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 |
|
|
|
RenX_ExtraLoggingPlugin::file = nullptr; |
|
|
|
|
|
|
|