diff options
author | Antony Woods <acron1@gmail.com> | 2014-10-24 09:40:09 +0100 |
---|---|---|
committer | Antony Woods <acron1@gmail.com> | 2014-10-24 09:40:09 +0100 |
commit | 693aac108de4dc62811b9a2737d895ada474cfb2 (patch) | |
tree | 44cc722afea8b6ef26095cd27aa64b97ec48d74e /include/logging.h | |
parent | 27bf11d35c8ce44fd9fef656e2975712846b9bb2 (diff) | |
parent | 4b3b8070e75ce0fc181e5c012c47da2a1e7a918e (diff) | |
download | crow-693aac108de4dc62811b9a2737d895ada474cfb2.tar.gz crow-693aac108de4dc62811b9a2737d895ada474cfb2.zip |
Post-pull commit
Diffstat (limited to 'include/logging.h')
-rw-r--r-- | include/logging.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/logging.h b/include/logging.h index 8f5b833..0d77071 100644 --- a/include/logging.h +++ b/include/logging.h @@ -9,8 +9,6 @@ #include "settings.h" -using namespace std; - namespace crow { enum class LogLevel @@ -24,13 +22,13 @@ namespace crow class ILogHandler { public: - virtual void log(string message, LogLevel level) = 0; + virtual void log(std::string message, LogLevel level) = 0; }; class CerrLogHandler : public ILogHandler { public: - void log(string message, LogLevel level) override { - cerr << message; + void log(std::string message, LogLevel level) override { + std::cerr << message; } }; @@ -38,18 +36,18 @@ namespace crow private: // - static string timestamp() + static std::string timestamp() { char date[32]; time_t t = time(0); strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", gmtime(&t)); - return string(date); + return std::string(date); } public: - logger(string prefix, LogLevel level) : level_(level) { + logger(std::string prefix, LogLevel level) : level_(level) { #ifdef CROW_ENABLE_LOGGING stringstream_ << "(" << timestamp() << ") [" << prefix << "] "; #endif @@ -58,7 +56,7 @@ namespace crow ~logger() { #ifdef CROW_ENABLE_LOGGING if(level_ >= get_current_log_level()) { - stringstream_ << endl; + stringstream_ << std::endl; get_handler_ref()->log(stringstream_.str(), level_); } #endif @@ -104,7 +102,7 @@ namespace crow } // - ostringstream stringstream_; + std::ostringstream stringstream_; LogLevel level_; }; } |