Commit b8ddb510 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fixing bug in logging with cout


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent ace478cb
......@@ -120,9 +120,6 @@ std::map<std::string, double> ReadoutErrorAcceleratorBufferPostprocessor::fix_as
double bp10 = errorRates[kv.second[1]].second;
std::stringstream s2;
s2 << ap01 << ", " << ap10 << ", " << bp01 << ", " << bp10 << "\n";
xacc::info(k0+ ", " + k1 + ", " + s2.str());
newExpects.insert({kv.first, exptZZ(oldExpects[kv.first], oldExpects[k0], oldExpects[k1], ap10, ap01, bp10, bp01)});
} else {
......
......@@ -268,6 +268,10 @@ const std::string translateWithVisitor(const std::string& originalSource, const
return visitor->toString();
}
void clearOptions() {
RuntimeOptions::instance()->clear();
}
/**
* This method should be called by clients to
* clean up and finalize the XACC framework. It should
......
......@@ -71,6 +71,8 @@ void info(const std::string& msg, MessagePredicate predicate = std::function<boo
void debug(const std::string& msg, MessagePredicate predicate = std::function<bool(void)>([]() {return true;}));
void error(const std::string& msg, MessagePredicate predicate = std::function<bool(void)>([]() {return true;}));
void clearOptions();
/**
* Return true if the option exists.
*
......
......@@ -197,7 +197,7 @@ public:
return false;
}
virtual bool isPhysical() {
virtual bool isRemote() {
return false;
}
......
......@@ -137,6 +137,11 @@ public:
return processResponse(buffer, responseStr);
}
virtual bool isRemote() {
return true;
}
protected:
std::shared_ptr<RestClient> restClient;
......
......@@ -72,8 +72,8 @@ std::string base64_decode(std::string const& encoded_string) {
}
XACCLogger::XACCLogger() :
useColor(
!RuntimeOptions::instance()->exists("no-color")) {
useColor(!RuntimeOptions::instance()->exists("no-color")), useCout(
RuntimeOptions::instance()->exists("use-cout")) {
logger = spdlog::stdout_logger_mt("xacc-logger");
......
......@@ -99,6 +99,49 @@ public:
using MessagePredicate = std::function<bool(void)>;
//class LoggerImpl {
//public:
//
// virtual void info(const std::string& msg) = 0;
// virtual void error(const std::string& msg) = 0;
//
//};
//
//class SpdlogImpl : public LoggerImpl {
//
//protected:
//
// std::shared_ptr<spdlog::logger> logger;
//
// bool useColor = true;
//
//public:
//
// SpdlogImpl() : useColor(
// !RuntimeOptions::instance()->exists("no-color")) {
// logger = spdlog::stdout_logger_mt("xacc-logger");
// }
//
// virtual void info(const std::string& msg) {
// logger->info(useColor ? "\033[1;34m" + msg + "\033[0m" : msg);
// }
//
// virtual void error(const std::string& msg) {
// logger->error(useColor ? );
// }
//};
//
//class CoutImpl : public LoggerImpl {
//
//public:
//
// virtual void info(const std::string& msg) {
// }
//
// virtual void error(const std::string& msg) {
// }
//};
class XACCLogger: public Singleton<XACCLogger> {
protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment