7684972a | /* Copyright (C) CJ Affiliate * * You may use, distribute and modify this code under the * terms of the GNU General Public License version 2 or * later. * * You should have received a copy of the license with this * file. If not, you will find a copy in the "LICENSE" file * at https://github.com/cjdev/dual-control. */ |
47f9faed | #ifndef __DUAL_CONTROL_LOGGING #define __DUAL_CONTROL_LOGGING #include <memory> #include <string> |
cdf7fd74 | class logger_ifc { public: virtual ~logger_ifc() {} |
b017a4d2 | virtual void log (int result, const std::string &user_name, const std::string &token) {}; |
47f9faed | }; |
370f8031 | |
cdf7fd74 | class logger : public logger_ifc { private: std::shared_ptr<logger_ifc> delegate_; public: |
b017a4d2 | logger (const std::shared_ptr<logger_ifc> &delegate) : delegate_ (delegate) {} logger() : logger (std::shared_ptr<logger_ifc> (new logger_ifc)) {} void log (int result, const std::string &user_name, const std::string &token) |
cdf7fd74 | { |
b017a4d2 | delegate_->log (result, user_name, token); |
cdf7fd74 | } |
370f8031 | }; |
47f9faed | #endif |
92957308 |