summaryrefslogtreecommitdiff
path: root/include/logger.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/logger.h')
-rw-r--r--include/logger.h41
1 files changed, 19 insertions, 22 deletions
diff --git a/include/logger.h b/include/logger.h
index b9065e2c9..89f251a9a 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef LOGGER_H
-#define LOGGER_H
+#pragma once
#include "anope.h"
#include "defs.h"
@@ -38,7 +37,7 @@ enum LogType
LOG_DEBUG_4
};
-struct LogFile
+struct LogFile final
{
Anope::string filename;
std::ofstream stream;
@@ -49,27 +48,27 @@ struct LogFile
};
/* Represents a single log message */
-class CoreExport Log
+class CoreExport Log final
{
- public:
+public:
/* Bot that should log this message */
- BotInfo *bi;
+ BotInfo *bi = nullptr;
/* For commands, the user executing the command, but might not always exist */
- User *u;
+ User *u = nullptr;
/* For commands, the account executing the command, but will not always exist */
- NickCore *nc;
+ NickCore *nc = nullptr;
/* For commands, the command being executed */
- Command *c;
+ Command *c = nullptr;
/* For commands, the command source */
- CommandSource *source;
+ CommandSource *source = nullptr;
/* Used for LOG_CHANNEL */
- Channel *chan;
+ Channel *chan = nullptr;
/* For commands, the channel the command was executed on, will not always exist */
- const ChannelInfo *ci;
+ const ChannelInfo *ci = nullptr;
/* For LOG_SERVER */
- Server *s;
+ Server *s = nullptr;
/* For LOG_MODULE */
- Module *m;
+ Module *m = nullptr;
LogType type;
Anope::string category;
@@ -95,11 +94,11 @@ class CoreExport Log
~Log();
- private:
+private:
Anope::string FormatSource() const;
Anope::string FormatCommand() const;
- public:
+public:
Anope::string BuildPrefix() const;
template<typename T> Log &operator<<(T val)
@@ -110,13 +109,13 @@ class CoreExport Log
};
/* Configured in the configuration file, actually does the message logging */
-class CoreExport LogInfo
+class CoreExport LogInfo final
{
- public:
- BotInfo *bot;
+public:
+ BotInfo *bot = nullptr;
std::vector<Anope::string> targets;
std::vector<LogFile *> logfiles;
- int last_day;
+ int last_day = 0;
std::vector<Anope::string> sources;
int log_age;
std::vector<Anope::string> admin;
@@ -140,5 +139,3 @@ class CoreExport LogInfo
/* Logs the message l if configured to */
void ProcessMessage(const Log *l);
};
-
-#endif // LOGGER_H