8 Log::Log() : mName(std::to_string(msID++)) {}
12 int Log::add(std::string where)
14 if (where ==
"console" || where ==
"") {
16 mSinks.push_back(std::make_shared<spdlog::sinks::stdout_color_sink_st>());
18 else if (where.find(
"file://") == 0) {
22 std::string p = where.substr(7);
23 SPD_TRACE(
"Testing file [{}] for write ...", p);
24 std::ofstream output(p.c_str());
25 if (output.is_open()) {
27 SPD_TRACE(
"Testing file [{}] for write is OK ...", p);
28 mSinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(p.c_str(),
true));
31 SPD_WARN(
"Problem creating log file [{}]!!!", p);
35 else if (where.find(
"zmq://") == 0) {
49 if (mpTarget ==
nullptr) {
53 mName = fmt::format(
"salsa-runlog-{}", msID);
55 mpTarget = std::make_shared<spdlog::logger>(mName.c_str(), mSinks.begin(), mSinks.end());
57 mpTarget->set_pattern(
"%v");
64 int Log::write(
char const * pContent)
67 mpTarget->info(
"{}", pContent);
static uint64_t msID
Static Job newName (holds index)