browsing: elangley-scraps
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>
a9690b1d
#include "sys_syslog.h"
cdf7fd74
class logger_ifc
{
public:
virtual ~logger_ifc() {}
706636a4
virtual void log (int result, const std::string &requester_user_name,
const std::string &authorizer_user_name,
3fc168fa
const std::string &token,
const std::string &reason) {};
47f9faed
};
370f8031
3ae0e083
class logger
cdf7fd74
{
bc6c3d35
public:
typedef std::shared_ptr<logger_ifc> delegate;
cdf7fd74
private:
a9690b1d
delegate delegate_;
cdf7fd74
public:
a9690b1d
logger (const delegate &delegate) : delegate_
b017a4d2
(delegate) {}
a9690b1d
logger() : logger (delegate (new logger_ifc)) {}
706636a4
void log (int result, const std::string &requester_user_name,
const std::string &authorizer_user_name,
3fc168fa
const std::string &token,
const std::string &reason)
cdf7fd74
{
b14fb8c6
delegate_->log (result, requester_user_name, authorizer_user_name, token,
reason);
cdf7fd74
}
bc6c3d35
static logger create (const sys_syslog &sys_syslog);
370f8031
};
47f9faed
#endif
92957308