diff options
| author | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-31 06:15:29 +0000 |
|---|---|---|
| committer | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-31 06:15:29 +0000 |
| commit | aa4b3e256377030d291fc2d5f4db94985ce04395 (patch) | |
| tree | 993302c0cbe754612f69c22bbbc57d00220cabd4 /include | |
| parent | 47504c9de5accda45a19627fd2b6ec13baa6ba95 (diff) | |
replaced the alog() command with a new type-safe and stream-based Alog()
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2777 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
| -rw-r--r-- | include/extern.h | 1 | ||||
| -rw-r--r-- | include/modules.h | 4 | ||||
| -rw-r--r-- | include/services.h | 26 | ||||
| -rw-r--r-- | include/users.h | 3 |
4 files changed, 31 insertions, 3 deletions
diff --git a/include/extern.h b/include/extern.h index 2e610f1fa..21b7bdb81 100644 --- a/include/extern.h +++ b/include/extern.h @@ -210,7 +210,6 @@ E const char *getstring(int index); E int open_log(); E void close_log(); -E void alog(const char *fmt, ...) FORMAT(printf,1,2); E void log_perror(const char *fmt, ...) FORMAT(printf,1,2); E void fatal(const char *fmt, ...) FORMAT(printf,1,2); E void fatal_perror(const char *fmt, ...) FORMAT(printf,1,2); diff --git a/include/modules.h b/include/modules.h index 450c48b10..cc42f4abc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -70,7 +70,7 @@ enum EventReturn } \ catch (CoreException& modexcept) \ { \ - alog("Exception caught: %s",modexcept.GetReason()); \ + Alog() << "Exception caught: " << modexcept.GetReason(); \ } \ _i = safei; \ } \ @@ -99,7 +99,7 @@ do { \ } \ catch (CoreException& modexcept) \ { \ - alog("Exception caught: %s",modexcept.GetReason()); \ + Alog() << "Exception caught: " << modexcept.GetReason(); \ } \ _i = safei; \ } \ diff --git a/include/services.h b/include/services.h index eb9fdc34d..7325685f5 100644 --- a/include/services.h +++ b/include/services.h @@ -1162,6 +1162,32 @@ struct Uplink { } }; +enum LogLevel +{ + LOG_NORMAL, + LOG_DEBUG, + LOG_DEBUG_2, + LOG_DEBUG_3, + LOG_DEBUG_4 +}; + +class CoreExport Alog +{ + private: + std::stringstream buf; + bool logit; + public: + Alog(LogLevel val = LOG_NORMAL); + ~Alog(); + template<typename T> Alog& operator<<(T val) + { + if (logit) + buf << val; + return *this; + } +}; + + class CoreExport Anope { public: diff --git a/include/users.h b/include/users.h index c5b67ab4c..dba200770 100644 --- a/include/users.h +++ b/include/users.h @@ -128,6 +128,9 @@ class CoreExport User : public Extensible */ const std::string &GetIdent() const; + /** Get the full mask ( nick!ident@realhost ) of a user + */ + const std::string GetMask(); /** Updates the realname of the user record. */ void SetRealname(const std::string &realname); |
