diff --git a/src/client/spark/view/Spark/Core/MDSource.cs b/src/client/spark/view/Spark/Core/MDSource.cs index 31c32cb73..1c1201d1f 100644 --- a/src/client/spark/view/Spark/Core/MDSource.cs +++ b/src/client/spark/view/Spark/Core/MDSource.cs @@ -76,7 +76,7 @@ namespace mbts.spark _publish_securities(); } catch (Exception e) { - Logger.error(bts.log.Subsystem.MarketData, $"Error in publish_securities: {e}"); + Logger.error(bts.log.Subsystem.md, $"Error in publish_securities: {e}"); } } await Task.Delay(TimeSpan.FromSeconds(1)); @@ -104,4 +104,4 @@ namespace mbts.spark } } -} \ No newline at end of file +} diff --git a/src/client/spark_core/logging/Logger.cs b/src/client/spark_core/logging/Logger.cs index ff92a9092..c69f8a44a 100644 --- a/src/client/spark_core/logging/Logger.cs +++ b/src/client/spark_core/logging/Logger.cs @@ -25,16 +25,15 @@ namespace bts.log { QBus, Log, Jetfix, - MarketData, + md, Api, - Persistence, + Persist, User, OrderMan, Latency, Assert, Engine, Ui, - Persist, ExSim, Mercury // Please keep this list in sync with logging.h/logging.cpp diff --git a/src/lib/logging/logging.cpp b/src/lib/logging/logging.cpp index 13d0291b1..9012a5f5b 100644 --- a/src/lib/logging/logging.cpp +++ b/src/lib/logging/logging.cpp @@ -92,16 +92,15 @@ void configure_logging(bts::config::Logging const&cfg) {log::QBus,"QBus"}, {log::Log,"Log"}, {log::Jetfix,"Jetfix"}, - {log::MarketData,"MarketData"}, + {log::md,"md"}, {log::Api,"Api"}, - {log::Persistence,"Persistence"}, + {log::persist,"persist"}, {log::User,"User"}, {log::OrderMan,"OrderMan"}, {log::Latency,"Latency"}, {log::Assert,"Assert"}, {log::Engine,"Engine"}, {log::Ui,"UI"}, - {log::Persist,"Persist"}, {log::ExSim,"ExSim"}, {log::Mercury,"Mercury"}, }; diff --git a/src/lib/logging/logging.h b/src/lib/logging/logging.h index 6e1d3fd4e..3683b3928 100644 --- a/src/lib/logging/logging.h +++ b/src/lib/logging/logging.h @@ -29,17 +29,16 @@ constexpr log::Subsystem Cfg {Gen.ordinal+1 }; constexpr log::Subsystem QBus {Cfg.ordinal+1 }; constexpr log::Subsystem Log {QBus.ordinal+1 }; constexpr log::Subsystem Jetfix {Log.ordinal+1 }; -constexpr log::Subsystem MarketData {Jetfix.ordinal+1 }; -constexpr log::Subsystem Api {MarketData.ordinal+1 }; -constexpr log::Subsystem Persistence{Api.ordinal+1 }; -constexpr log::Subsystem User {Persistence.ordinal+1 }; +constexpr log::Subsystem md {Jetfix.ordinal+1 }; +constexpr log::Subsystem Api {md.ordinal+1 }; +constexpr log::Subsystem persist {Api.ordinal+1 }; +constexpr log::Subsystem User {persist.ordinal+1 }; constexpr log::Subsystem OrderMan {User.ordinal+1 }; constexpr log::Subsystem Latency {OrderMan.ordinal+1 }; constexpr log::Subsystem Assert {Latency.ordinal+1 }; constexpr log::Subsystem Engine {Assert.ordinal+1 }; constexpr log::Subsystem Ui {Engine.ordinal+1 }; -constexpr log::Subsystem Persist {Ui.ordinal+1 }; -constexpr log::Subsystem ExSim {Persist.ordinal+1 }; +constexpr log::Subsystem ExSim {Ui.ordinal+1 }; constexpr log::Subsystem Mercury {ExSim.ordinal+1 }; struct LoggerHandle { diff --git a/src/lib/md/Diag/ShmDumper.cpp b/src/lib/md/Diag/ShmDumper.cpp index 9860eb3f0..309206ff0 100644 --- a/src/lib/md/Diag/ShmDumper.cpp +++ b/src/lib/md/Diag/ShmDumper.cpp @@ -195,7 +195,7 @@ string dump_entry(const HotEntry& entry) { void ShmDumper::dump_cold() { SharedListReader reader(_name+"_cold"); - if (!reader.is_initialized()) { LOG(MarketData,Info,"Unable to initialize section {}", _name); return; } + if (!reader.is_initialized()) { LOG(md,Info,"Unable to initialize section {}", _name); return; } const auto& header = reader.header(); // dump the header cout << "{ " << endl; @@ -212,7 +212,7 @@ void ShmDumper::dump_cold() { template void dump_hot_t(SharedListReader& reader) { - if (!reader.is_initialized()) { LOG(MarketData,Info,"Unable to initialize section "); return; } + if (!reader.is_initialized()) { LOG(md,Info,"Unable to initialize section "); return; } auto& header = reader.header(); cout << "{ " << endl; cout << "'header': { 'count': " << header.count << ", 'segment_count': " << header.segment_count << ", 'bbo_count': " << header.bbo_count << ", 'depth_count': " << header.depth_count << "}," << endl; @@ -225,7 +225,7 @@ void ShmDumper::dump_hot() { SharedListReader cold_reader(_name + "_cold"); if (!cold_reader.is_initialized()) { - LOG(MarketData,Info, + LOG(md,Info, "Unable to initialize section {}_cold - needed to " "determine metadata.",_name); return; diff --git a/src/lib/md/MDConsumer.cpp b/src/lib/md/MDConsumer.cpp index 790e4d91d..0798b0717 100644 --- a/src/lib/md/MDConsumer.cpp +++ b/src/lib/md/MDConsumer.cpp @@ -134,9 +134,9 @@ public: find_hot(_hot.get(), key); if (!*ppvhot) { std::this_thread::sleep_for(1ms); - if (count == 4096) LOG(MarketData,Error, "Waiting an awfully long time for key: {}",key); + if (count == 4096) LOG(md,Error, "Waiting an awfully long time for key: {}",key); if (count == 60000) { - LOG(MarketData,Error, + LOG(md,Error, "Waited far too long for key: {} security discovery may be hung." " symbol: {} type: {}", key, @@ -467,7 +467,7 @@ public: // We can safely send a security key to every _instance because by definition // a security cannot appear in 2 instances if (unresolved_securities.size() > 250) { - LOG(MarketData,Warn,"Failed to resolve legs for {}" + LOG(md,Warn,"Failed to resolve legs for {}" " spreads. This can happen when a spread is subscribed without " "it's underliers and may lead to higher than expected CPU use.", unresolved_securities.size() ); @@ -595,7 +595,7 @@ MDConsumer::MDConsumer(bool shared) : _pimpl() { if (msg.tellp() > 0) { msg << ", "; } msg << symbol.symbol() << "-" << SecurityType_Name(symbol.type()) << " " << Venue_Name(symbol.exchange()); } - LOG(MarketData,Info,"Created MDConsumer for securities: {}" ,msg.str()); + LOG(md,Info,"Created MDConsumer for securities: {}" ,msg.str()); _pimpl.reset(new MDConsumerImpl(all_symbols, shared)); } @@ -608,7 +608,7 @@ MDConsumer::MDConsumer(Venue exchange, bool shared) : _pimpl() { if (msg.tellp() > 0) { msg << ", "; } msg << symbol.symbol() << "-" << SecurityType_Name(symbol.type()) << " " << Venue_Name(symbol.exchange()); } - LOG(MarketData,Info, "Created MDConsumer for securities: {}" ,msg.str()); + LOG(md,Info, "Created MDConsumer for securities: {}" ,msg.str()); _pimpl.reset(new MDConsumerImpl(all_symbols, shared)); } diff --git a/src/lib/md/MDProducer.cpp b/src/lib/md/MDProducer.cpp index c2c6f1734..d402179e3 100644 --- a/src/lib/md/MDProducer.cpp +++ b/src/lib/md/MDProducer.cpp @@ -75,7 +75,7 @@ public: _cold.header().rfq_count++; } else { - LOG(MarketData,Warn, "Unable to store RFQ due to size limitation {}", + LOG(md,Warn, "Unable to store RFQ due to size limitation {}", rfq.DebugString()); } } diff --git a/src/lib/md/MDRecoverableConsumer.cpp b/src/lib/md/MDRecoverableConsumer.cpp index 632b72099..a712710b8 100644 --- a/src/lib/md/MDRecoverableConsumer.cpp +++ b/src/lib/md/MDRecoverableConsumer.cpp @@ -137,7 +137,7 @@ void MDRecoverableConsumer::cleanup() { [](unique_ptr& pgroup) -> bool { return pgroup->handles.empty(); }), _old.end()); if (old_sz > _old.size ()) { - LOG (MarketData,Info,"Cleaned up {} MDConsumer instances" ,old_sz - _old.size () ); + LOG (md,Info,"Cleaned up {} MDConsumer instances" ,old_sz - _old.size () ); } } diff --git a/src/lib/md/PlatformLoader.cpp b/src/lib/md/PlatformLoader.cpp index 0428a01f5..ff9012f28 100644 --- a/src/lib/md/PlatformLoader.cpp +++ b/src/lib/md/PlatformLoader.cpp @@ -36,10 +36,10 @@ void cleanup_shared_memory(const std::set& symbols, Platform platfor for (const auto& sym : symbols) { string name = hot_segment_name(sym.symbol(), sym.type(), sym.exchange(), platform); utils::SharedList::delete_segments(name); - LOG(MarketData,Info, "Cleaned up /run/shm/{}", name); + LOG(md,Info, "Cleaned up /run/shm/{}", name); name = cold_segment_name(sym.symbol(), sym.type(), sym.exchange(), platform); utils::SharedList::delete_segments(name); - LOG(MarketData,Info, "Cleaned up /run/shm/{}", name); + LOG(md,Info, "Cleaned up /run/shm/{}", name); } } @@ -49,7 +49,7 @@ void PlatformLoader::run() { set symbols; size_t count = get_system_md_symbols(_config, symbols); if (count == 0) { - LOG(MarketData,Error, "No Symbols configured for this publisher."); + LOG(md,Error, "No Symbols configured for this publisher."); return; } diff --git a/src/lib/md/SecurityIDRecorder.cpp b/src/lib/md/SecurityIDRecorder.cpp index c422c7b7e..69567de2c 100644 --- a/src/lib/md/SecurityIDRecorder.cpp +++ b/src/lib/md/SecurityIDRecorder.cpp @@ -190,11 +190,11 @@ security_key SecurityIDRecorder::insert(const std::string& descriptor, SecurityT // Just in case our insert failed due to duplicate row auto key = search(descriptor); if (key == invalid_security_key) { - LOG(MarketData,Error,"Failed to assign security key. SQLite return code: {}",result); + LOG(md,Error,"Failed to assign security key. SQLite return code: {}",result); } return key; } }}//namespace -#endif \ No newline at end of file +#endif diff --git a/src/lib/md/SecurityIndex.h b/src/lib/md/SecurityIndex.h index 1104adb1b..6ea7eea4b 100644 --- a/src/lib/md/SecurityIndex.h +++ b/src/lib/md/SecurityIndex.h @@ -67,7 +67,7 @@ public: // result is pair auto result = _map.insert(std::make_pair(key, std::unique_ptr())); if (!result.second) { - LOG(MarketData,Error, "Found duplicate entry for platform id '{} - " ,key); + LOG(md,Error, "Found duplicate entry for platform id '{} - " ,key); bts_assert(result.second); } result.first->second = std::move(entry); @@ -161,7 +161,7 @@ public: return accessor->second; } else { - LOG(MarketData,Error, "Found duplicate entry for platform id '{}' - ",key); + LOG(md,Error, "Found duplicate entry for platform id '{}' - ",key); bts_assert(false); } } diff --git a/src/lib/md/relay/QueryServer.cpp b/src/lib/md/relay/QueryServer.cpp index 805db7c57..704a408bb 100644 --- a/src/lib/md/relay/QueryServer.cpp +++ b/src/lib/md/relay/QueryServer.cpp @@ -188,7 +188,7 @@ struct QueryServerImpl : public IQueryServer { size_t count = group.second->consumer.scan_securities(false); auto delta = (TimeStamp::now() - start); if (delta.milliseconds() > 10) { - LOG(MarketData,Diag,"Scanned handles: {}ms found: {} securities. " , + LOG(md,Diag,"Scanned handles: {}ms found: {} securities. " , delta.milliseconds() ,count ,group.second->symbol ); } } @@ -254,7 +254,7 @@ struct QueryServerImpl : public IQueryServer { } } else if (result == HandleReadResult::BUSY) { - LOG(MarketData,Info, "Busy read on handle {}. Retry on next request", instrument.handle.key()); + LOG(md,Info, "Busy read on handle {}. Retry on next request", instrument.handle.key()); // If we get a busy reading BBO (which happens 1-2x per day for a single relay client) // We move the timestamp back so the next request will try to read this value again. // ALTERNATIVE: We could spin until the value was not busy but it could be that the writer @@ -350,7 +350,7 @@ struct MDRelayServer : bts::co2::MarketDataRelayBase { TimeStamp start = TimeStamp::now(); _db.query(request, preply); auto elapsed = (TimeStamp::now() - start); - LOG(MarketData, Diag, + LOG(md, Diag, "Request for: {} took {}us and returned {} bytes before compression", request.host(), elapsed.microseconds(), diff --git a/src/lib/md/relay/RelayClient.cpp b/src/lib/md/relay/RelayClient.cpp index d8ff71052..655943baa 100644 --- a/src/lib/md/relay/RelayClient.cpp +++ b/src/lib/md/relay/RelayClient.cpp @@ -133,7 +133,7 @@ public: // RFQ and TRADE LOG if (ch.trade_log_size() > 0 || ch.rfq_log_size() > 0) { if (ch.trade_log_size() > 0) { - LOG(MarketData,Diag, "Added {} trades", ch.trade_log_size()); + LOG(md,Diag, "Added {} trades", ch.trade_log_size()); } for (const auto& trade : ch.trade_log()) { channel.add_trade(trade); @@ -144,7 +144,7 @@ public: } } if (added_security_count > 0) { - LOG(MarketData,Diag,"Added {} {} - {}" , + LOG(md,Diag,"Added {} {} - {}" , added_security_count , ch.channel().symbol() ,SecurityType_Name(ch.channel().type())); } } @@ -216,7 +216,7 @@ public: auto now = utils::TimeStamp::now(); if ((now - _request_log).seconds() > 60) { _request_log = now; - LOG(MarketData, Info, "Requesting MD: {}", _request.DebugString()); + LOG(md, Info, "Requesting MD: {}", _request.DebugString()); } _rpc.requestmd(_request, [=](api::Result r) { receive_md(r); cont(); }, 500u); } @@ -229,7 +229,7 @@ public: if (has_new_security && _pconsumer) { scan_securities_thread().post([=]() { auto count = _pconsumer->scan_securities(true); - LOG(MarketData, Info, "Discovered {} securities.", count); + LOG(md, Info, "Discovered {} securities.", count); }); } // Update reply timetamps @@ -243,7 +243,7 @@ public: req.set_trade_cursor(reply.channel().trade_cursor()); req.set_rfq_cursor(reply.channel().rfq_cursor()); if (req.segment_id() != reply.channel().segment_id()) { - LOG(MarketData, Diag, "New segment_id = {}", reply.channel().segment_id()); + LOG(md, Diag, "New segment_id = {}", reply.channel().segment_id()); req.set_segment_id(reply.channel().segment_id()); } } diff --git a/src/lib/md/relay/RelayRecorder.cpp b/src/lib/md/relay/RelayRecorder.cpp index 3506da79f..d54d7d0a1 100644 --- a/src/lib/md/relay/RelayRecorder.cpp +++ b/src/lib/md/relay/RelayRecorder.cpp @@ -52,7 +52,7 @@ RelayRecorder::RelayRecorder(const std::string& base_path, const std::string& fi _filename(base_path+"/"+filename), _file() { - LOG(MarketData,Info,"Recording market data to: {}" , _filename); + LOG(md,Info,"Recording market data to: {}" , _filename); boost::system::error_code ec; boost::filesystem::create_directories(base_path, ec); _file.open(_filename, ios::out | ios::binary | ios::trunc); @@ -140,7 +140,7 @@ void replay_file(const std::string& filename, IRelayWriter& writer, int32_t nagg replay_recording(in, writer, naggle_ms); } else { - LOG(MarketData,Diag, "Cannot read file {}", filename); + LOG(md,Diag, "Cannot read file {}", filename); if (loop) sleep_for(10s); } diff --git a/src/lib/utils/HTTPStream.cpp b/src/lib/utils/HTTPStream.cpp index 543ac69c6..e594fa41f 100755 --- a/src/lib/utils/HTTPStream.cpp +++ b/src/lib/utils/HTTPStream.cpp @@ -50,7 +50,7 @@ HTTPStream::HTTPStream(const std::string& host, const std::string& path, const s *this << "\r\n"; if (bad()) { - LOG(MarketData,Error,"Failed to connect to host {}. Error: {}", + LOG(md,Error,"Failed to connect to host {}. Error: {}", host,error().message() ); bts_assert_msg(!bad(), error().message()); } @@ -82,7 +82,7 @@ bool download_file_if_newer(const string& host, const string& path, const string // If our file mtime is newer do not download if (difftime(modified, st.st_mtime) > 0) { - LOG(MarketData,Info,"Downloading from: {}{}",host,path); + LOG(md,Info,"Downloading from: {}{}",host,path); ofstream writer(destination.c_str(), ios::out | ios::binary); if (writer) { // This removes all '\n' characters @@ -96,7 +96,7 @@ bool download_file_if_newer(const string& host, const string& path, const string } } else { - LOG(MarketData,Info,"Skipping download as cache is newer"); + LOG(md,Info,"Skipping download as cache is newer"); } return false; diff --git a/src/lib/utils/SharedList.h b/src/lib/utils/SharedList.h index 7e867fd57..d2738859b 100644 --- a/src/lib/utils/SharedList.h +++ b/src/lib/utils/SharedList.h @@ -75,7 +75,7 @@ public: } ~SharedList() { - LOG(MarketData,Info, "~SharedList {}" ,_name); + LOG(md,Info, "~SharedList {}" ,_name); delete_segments(_name); } @@ -138,7 +138,7 @@ private: char segment_name[512]; get_segment_name(segment_name, BTS_ARRAYSIZE(segment_name), _name, _segments_mapped); - LOG(MarketData,Info,"Creating shared segment '{}'", std::string(segment_name)); + LOG(md,Info,"Creating shared segment '{}'", std::string(segment_name)); _current_region = _shm->create(segment_name, size).address; bts_assert(_current_region); @@ -250,14 +250,14 @@ private: SharedList::get_segment_name(segment_name, BTS_ARRAYSIZE(segment_name), _name, 0); auto segment = _shm->open(segment_name, !os::is_windows()); if (segment) { - LOG(MarketData,Info, "Opening shared segment '{}' - SUCCEEDED",std::string(segment_name)); + LOG(md,Info, "Opening shared segment '{}' - SUCCEEDED",std::string(segment_name)); _header = (THeader*)(segment.address + sizeof(SegmentHeader)); _segments.push_back(segment); // Map all segments check_segments(); } else { - LOG_ONCE_MAYBE(MarketData,Diag, "Opening shared segment '{}' - FAILED",std::string(segment_name)); + LOG_ONCE_MAYBE(md,Diag, "Opening shared segment '{}' - FAILED",std::string(segment_name)); return; } } diff --git a/src/lib/utils/SharedMemory.cpp b/src/lib/utils/SharedMemory.cpp index cab42d06c..199a65715 100644 --- a/src/lib/utils/SharedMemory.cpp +++ b/src/lib/utils/SharedMemory.cpp @@ -108,7 +108,7 @@ struct BoostLowLevelSharedMemoryImpl { remove_if(_mappings.begin(), _mappings.end(), [&](const pair& p) { return p.first.get_name() == segment_name; }), _mappings.end()); - LOG(MarketData,Diag, "Remove shared memory segment: {}" , std::string(segment_name)); + LOG(md,Diag, "Remove shared memory segment: {}" , std::string(segment_name)); return boost::interprocess::shared_memory_object::remove(segment_name.c_str()); } vector> _mappings; diff --git a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Listener.cpp b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Listener.cpp index df360c325..7e2814191 100644 --- a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Listener.cpp +++ b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Listener.cpp @@ -109,16 +109,16 @@ MDP3Listener::~MDP3Listener() { // // Warnings/Errors void MDP3Listener::onError(onixs::Handler&, const onixs::ErrorArgs& error) { - LOG(MarketData,Warn, "OnixS Error: {} - {}", error.description(), error.source()); + LOG(md,Warn, "OnixS Error: {} - {}", error.description(), error.source()); } void MDP3Listener::onWarning(onixs::Handler&, const onixs::WarningArgs& warning) { - LOG(MarketData,Warn, "OnixS Warn: {} - {}", warning.description(), warning.source()); + LOG(md,Warn, "OnixS Warn: {} - {}", warning.description(), warning.source()); } void MDP3Listener::onInstrumentRecovery(onixs::Handler& h) { - LOG(MarketData,Info, "Beginning security definition recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Beginning security definition recovery for channel {}", h.settings().channel()); } void MDP3Listener::onEndOfInstrumentRecovery(onixs::Handler& h, const onixs::RecoveryCompletionArgs&) { - LOG(MarketData,Info, "Finished Security definition recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Finished Security definition recovery for channel {}", h.settings().channel()); } // void MDP3Listener::onGap(onixs::Handler& h, const Security&, unsigned) { // update_all_status(COCONUTSECURITYSTATUS_PACKET_LOSS); @@ -129,19 +129,19 @@ void MDP3Listener::onEndOfInstrumentRecovery(onixs::Handler& h, const onixs::Rec // Gap Recovery void MDP3Listener::onMarketRecovery(onixs::Handler& h) { update_all_status(COCONUTSECURITYSTATUS_PACKET_LOSS); - LOG(MarketData,Info, "Beginning market recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Beginning market recovery for channel {}", h.settings().channel()); } void MDP3Listener::onEndOfMarketRecovery(onixs::Handler& h, const onixs::RecoveryCompletionArgs&) { update_all_status(COCONUTSECURITYSTATUS_OK); - LOG(MarketData,Info, "Finished market recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Finished market recovery for channel {}", h.settings().channel()); } void MDP3Listener::onTcpRecovery(onixs::Handler& h) { update_all_status(COCONUTSECURITYSTATUS_PACKET_LOSS); - LOG(MarketData,Info, "Beginning tcp recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Beginning tcp recovery for channel {}", h.settings().channel()); } void MDP3Listener::onEndOfTcpRecovery(onixs::Handler& h, const onixs::RecoveryCompletionArgs&) { update_all_status(COCONUTSECURITYSTATUS_OK); - LOG(MarketData,Info, "Finished tcp recovery for channel {}", h.settings().channel()); + LOG(md,Info, "Finished tcp recovery for channel {}", h.settings().channel()); } // @@ -152,7 +152,7 @@ void MDP3Listener::onPacket(onixs::Handler&, const onixs::PacketArgs& args) { auto seq = args.packet().seqNumber(); if (!_book_updates.empty()) { if (_latest_sequence != seq) { - LOG(MarketData, Error, "Expected sequence {} got {} did not flush {} book updates.", + LOG(md, Error, "Expected sequence {} got {} did not flush {} book updates.", _latest_sequence, seq, _book_updates.size()); } } @@ -218,7 +218,7 @@ void set_security_common(const Definition& def, FixedSecurity& fsec) { void MDP3Listener::onDefinition(onixs::Handler&, const onixs::Security& osec, const onixs::InstrumentDefinitionFutureArgs& def) { const auto& sec = def.message(); auto exchange_id = sec.securityId(); - LOG(MarketData, Info, "onDefinition future {}", exchange_id); + LOG(md, Info, "onDefinition future {}", exchange_id); if (filter_security(exchange_id, sec) != ADD) return; bts_assert(exchange_id == osec.id()); @@ -240,7 +240,7 @@ void MDP3Listener::onDefinition(onixs::Handler&, const onixs::Security& osec, co void MDP3Listener::onDefinition(onixs::Handler&, const onixs::Security&, const onixs::InstrumentDefinitionOptionArgs& def) { const auto& sec = def.message(); auto exchange_id = sec.securityId(); - LOG(MarketData, Info, "onDefinition option {}", exchange_id); + LOG(md, Info, "onDefinition option {}", exchange_id); if (filter_security(exchange_id, sec) != ADD) return; FixedOptionSecurity fsec; @@ -275,7 +275,7 @@ void MDP3Listener::onDefinition(onixs::Handler&, const onixs::Security&, const o void MDP3Listener::onDefinition(onixs::Handler&, const onixs::Security&, const onixs::InstrumentDefinitionSpreadArgs& spread_args) { const auto& sec = spread_args.message(); auto exchange_id = sec.securityId(); - LOG(MarketData, Info, "onDefinition spread {}", exchange_id); + LOG(md, Info, "onDefinition spread {}", exchange_id); if (filter_security(exchange_id, sec) != ADD) return; // Filter out any already expired spreads diff --git a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp index b6880ec67..f3548c8a7 100644 --- a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp +++ b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Main.cpp @@ -130,7 +130,7 @@ void MDP3Main::run(std::vector& symbols) { _listeners.push_back(prepare_listener(*_handlers.back(), channel)); std::stringstream symstr; for (const auto& sym : channel.symbols) { symstr << sym.symbol() << "-" << SecurityType_Name(sym.type()) << " "; } - LOG(MarketData,Info, "CME: Initialized channel {} ({})",channel.id,symstr.str()); + LOG(md,Info, "CME: Initialized channel {} ({})",channel.id,symstr.str()); } onixs::SessionSettings settings; @@ -164,7 +164,7 @@ void MDP3Main::run(std::vector& symbols) { }); heartbeat_timer.start(); - LOG(MarketData,Info, "** CME MDP3 Publisher started **"); + LOG(md,Info, "** CME MDP3 Publisher started **"); disp.run(); } @@ -181,7 +181,7 @@ void MDP3Main::initialize() { if (license == "{default}") { init_settings.licenseStore(os::bts_data_path() + "/licenses/"); } - LOG(MarketData,Info,"Loading onixs license from {}", init_settings.licenseStore()); + LOG(md,Info,"Loading onixs license from {}", init_settings.licenseStore()); onixs::initialize(init_settings); } @@ -190,7 +190,7 @@ void MDP3Main::initialize() { unique_ptr MDP3Main::prepare_handler(const string& channel_id) { const auto& pub_options = config::get(); const auto& options = channel_settings_for(channel_id); - LOG(MarketData,Info,"Loaded channel options for channel {}:\n{}",channel_id ,options.DebugString()); + LOG(md,Info,"Loaded channel options for channel {}:\n{}",channel_id ,options.DebugString()); onixs::HandlerSettings settings; settings.channel(std::stoul(channel_id)); @@ -275,7 +275,7 @@ unique_ptr MDP3Main::prepare_handler(const string& channel_id) { std::unique_ptr recovery; if (options.use_tcp_replay()) { - LOG(MarketData,Info,"CME: Enabled TCP replay"); + LOG(md,Info,"CME: Enabled TCP replay"); onixs::TcpRecoverySettings tcpSettings; tcpSettings.username(options.tcp_replay_username()); tcpSettings.password(options.tcp_replay_password()); @@ -303,7 +303,7 @@ unique_ptr MDP3Main::prepare_handler(const string& channel_id) { return handler; } catch (std::exception& e) { - LOG(MarketData,Error,"{}", std::string(e.what())); + LOG(md,Error,"{}", std::string(e.what())); throw; } } diff --git a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Utils.cpp b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Utils.cpp index e432a92b8..41de0a836 100644 --- a/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Utils.cpp +++ b/src/server/sparkd/md/platforms/mdp3_onixs/MDP3Utils.cpp @@ -40,7 +40,7 @@ bool check_file_exists_with_instructions(const string& filename, const string& u } if (!boost::filesystem::exists(filename)) { if (log) { - LOG(MarketData,Error, + LOG(md,Error, "File {} is not present on this system. " "Please download it from the CME ftp site. " "I will wait until the file is present.\n$ curl {} > {} ", @@ -90,7 +90,7 @@ SecurityType infer_security_type(const string& label) { } // TODO: Allow configuration to override this? - LOG(MarketData,Warn,"Unable to guess security type from label: '{}" + LOG(md,Warn,"Unable to guess security type from label: '{}" "' Treating as OPTION.",label); return SECURITYTYPE_OPTION; } @@ -105,7 +105,7 @@ const vector parse_channels(const vector& symbols) { auto configuration = doc.root().child("configuration"); bts_assert(configuration); - LOG(MarketData,Info,"CME: Loaded '{}' config. Last updated: {}" , + LOG(md,Info,"CME: Loaded '{}' config. Last updated: {}" , std::string(configuration.attribute("environment").as_string("??")), std::string(configuration.attribute("updated").as_string("??"))); auto channels = configuration.children("channel"); diff --git a/src/server/sparkd/md/run_md.cpp b/src/server/sparkd/md/run_md.cpp index c8e30f116..83cc1af9b 100644 --- a/src/server/sparkd/md/run_md.cpp +++ b/src/server/sparkd/md/run_md.cpp @@ -21,7 +21,7 @@ namespace bts { namespace md { void clean_dir(const std::string base_path) { - LOG(MarketData, Info, "Cleaning shared memory"); + LOG(md, Info, "Cleaning shared memory"); namespace fs = boost::filesystem; const fs::path p(base_path); auto file_prefix = "bts_edge_" + config::get().shared_memory_namespace() + "_"; @@ -33,7 +33,7 @@ void clean_dir(const std::string base_path) { if (name.find(file_prefix) != std::string::npos) { boost::system::error_code err; fs::remove(dir_iter->path(), err); - if (!err) LOG(MarketData, Info, "Cleaned up {}", dir_iter->path()); + if (!err) LOG(md, Info, "Cleaned up {}", dir_iter->path()); } } else if (fs::is_directory(dir_iter->status())) { diff --git a/src/server/sparkd/orderman/persistence/FillDB.cpp b/src/server/sparkd/orderman/persistence/FillDB.cpp index af1f26be4..1468ebcb1 100644 --- a/src/server/sparkd/orderman/persistence/FillDB.cpp +++ b/src/server/sparkd/orderman/persistence/FillDB.cpp @@ -44,7 +44,7 @@ std::vector FillDB::retrieve_all() if (utils::pb::from_string (kvp.second,&nf)) result.emplace_back(nf); else - LOG(Persistence,Error, + LOG(persist,Error, "Could not recover fill {} from storage. " "This should be investigated", kvp.first); diff --git a/src/server/sparkd/orderman/persistence/OrderDB.cpp b/src/server/sparkd/orderman/persistence/OrderDB.cpp index e59f5bffe..42f67d4b2 100644 --- a/src/server/sparkd/orderman/persistence/OrderDB.cpp +++ b/src/server/sparkd/orderman/persistence/OrderDB.cpp @@ -44,7 +44,7 @@ std::vector OrderDB::retrieve_all() if (utils::pb::from_string (kvp.second,&os)) result.emplace_back(os); else - LOG(Persistence,Error, + LOG(persist,Error, "Could not recover order {} from storage. " "This should be investigated", kvp.first); diff --git a/src/server/sparkd/orderman2/actors/FillStore.cpp b/src/server/sparkd/orderman2/actors/FillStore.cpp index 5262a22b1..dd9d89942 100644 --- a/src/server/sparkd/orderman2/actors/FillStore.cpp +++ b/src/server/sparkd/orderman2/actors/FillStore.cpp @@ -39,7 +39,7 @@ void FillStore::init() me->known_fills[fk] = std::move(fill); } else - LOG(Persistence,Error, + LOG(persist,Error, "Could not recover fill {} from storage. " "This should be investigated", kvp.first); diff --git a/src/server/sparkd/orderman2/actors/OrderStore.cpp b/src/server/sparkd/orderman2/actors/OrderStore.cpp index de4e752c6..bd869d206 100644 --- a/src/server/sparkd/orderman2/actors/OrderStore.cpp +++ b/src/server/sparkd/orderman2/actors/OrderStore.cpp @@ -45,7 +45,7 @@ void OrderStore::init() me->known_orders[ok] = std::move(order_record); } else - LOG(Persistence,Error, + LOG(persist,Error, "Could not recover order {} from storage. " "This should be investigated", kvp.first); diff --git a/src/server/sparkd/orderman2/actors/SecuritySrc.cpp b/src/server/sparkd/orderman2/actors/SecuritySrc.cpp index 2eb564b74..e74a448cc 100644 --- a/src/server/sparkd/orderman2/actors/SecuritySrc.cpp +++ b/src/server/sparkd/orderman2/actors/SecuritySrc.cpp @@ -47,7 +47,7 @@ void SecuritySrc::init() me->to_publish.push_back(ptr_cpy); } else - LOG(Persistence,Error, + LOG(persist,Error, "Could not retrieve security with key {} from storage. " "This security will be ignored " "Security string is: {} ", kvp.first, kvp.second); diff --git a/src/server/sparkd/persistence/PersistenceServiceServer.cpp b/src/server/sparkd/persistence/PersistenceServiceServer.cpp index 60aec6dd5..60471e74e 100644 --- a/src/server/sparkd/persistence/PersistenceServiceServer.cpp +++ b/src/server/sparkd/persistence/PersistenceServiceServer.cpp @@ -52,7 +52,7 @@ PersistenceServiceServer::PersistenceServiceServer(bts::api::ServiceContext & co PersistenceServiceBase(context,db), me (new PImpl(db)) { - LOG(Persistence,Warn,"Starting persistence service for {}",db); + LOG(persist,Warn,"Starting persistence service for {}",db); bts_assert(db.size()); // load data @@ -75,11 +75,11 @@ PersistenceServiceServer::~PersistenceServiceServer() {} void PersistenceServiceServer::retrieve(const RetrieveRequest& request, const std::function& reply) { - LOG(Persistence,Diag, "Retrieving {} rows from {}/{}", request.key().size(), me->db,request.ns()); + LOG(persist,Diag, "Retrieving {} rows from {}/{}", request.key().size(), me->db,request.ns()); RetrieveResponse response; if (request.ns().empty()) { - LOG(Persistence,Error, "Client used empty namespace while trying to retrieve rows in database {}", + LOG(persist,Error, "Client used empty namespace while trying to retrieve rows in database {}", me->db); response.set_result ( RetrieveResponse::EMPTY_NS); reply(response); @@ -88,7 +88,7 @@ void PersistenceServiceServer::retrieve(const RetrieveRequest& request, auto it = me->data.find(request.ns()); if (it == me->data.end()) { - LOG(Persistence,Error, "Client tried to retrieve specific rows from unknown namespace {}/{}", + LOG(persist,Error, "Client tried to retrieve specific rows from unknown namespace {}/{}", me->db,request.ns()); response.set_result ( RetrieveResponse::NO_SUCH_NS); reply(response); @@ -100,7 +100,7 @@ void PersistenceServiceServer::retrieve(const RetrieveRequest& request, for (auto &k : request.key()) { if (keys.count(k)) { - LOG(Persistence,Error, "Client tried to retrieve row with key {} twice in {}/{}", k, + LOG(persist,Error, "Client tried to retrieve row with key {} twice in {}/{}", k, me->db,request.ns()); response.set_result ( RetrieveResponse::DUPLICATE_KEY); reply(response); @@ -108,7 +108,7 @@ void PersistenceServiceServer::retrieve(const RetrieveRequest& request, } auto it = known_rows.find(k); if (it == known_rows.end()) { - LOG(Persistence,Error, "Client tried to retrieve unknown row with key {} in {}/{}", k, + LOG(persist,Error, "Client tried to retrieve unknown row with key {} in {}/{}", k, me->db,request.ns()); response.set_result ( RetrieveResponse::DUPLICATE_KEY); reply(response); @@ -121,18 +121,18 @@ void PersistenceServiceServer::retrieve(const RetrieveRequest& request, } response.set_result ( RetrieveResponse::OK); reply(response); - LOG(Persistence,Diag, "Successfully retrieved {} rows from {}/{}", request.key().size(), + LOG(persist,Diag, "Successfully retrieved {} rows from {}/{}", request.key().size(), me->db,request.ns()); } void PersistenceServiceServer::retrieve_all(const RetrieveAllRequest& request, const std::function& reply) { - LOG(Persistence,Diag, "Retrieving all rows from {}/{}", me->db,request.ns()); + LOG(persist,Diag, "Retrieving all rows from {}/{}", me->db,request.ns()); RetrieveResponse response; if (request.ns().empty()) { - LOG(Persistence,Error, "Client used empty namespace while trying to retrieve rows in database {}", + LOG(persist,Error, "Client used empty namespace while trying to retrieve rows in database {}", me->db); response.set_result ( RetrieveResponse::EMPTY_NS); reply(response); @@ -152,18 +152,18 @@ void PersistenceServiceServer::retrieve_all(const RetrieveAllRequest& request, response.set_result ( RetrieveResponse::OK); reply(response); - LOG(Persistence,Diag, "Successfully retrieved all {} rows from {}/{}", v.size(),me->db,request.ns()); + LOG(persist,Diag, "Successfully retrieved all {} rows from {}/{}", v.size(),me->db,request.ns()); } void PersistenceServiceServer::remove(const RemoveRequest& request, const std::function& reply) { - LOG(Persistence,Diag, "Removing {} rows from {}/{}", request.key().size(), me->db,request.ns()); + LOG(persist,Diag, "Removing {} rows from {}/{}", request.key().size(), me->db,request.ns()); RemoveResponse response; if (request.ns().empty()) { - LOG(Persistence,Error, "Client used empty namespace while trying to remove rows in database {}", me->db); + LOG(persist,Error, "Client used empty namespace while trying to remove rows in database {}", me->db); response.set_result ( RemoveResponse::EMPTY_NS); reply(response); return; @@ -171,7 +171,7 @@ void PersistenceServiceServer::remove(const RemoveRequest& request, auto it = me->data.find(request.ns()); if (it == me->data.end()) { - LOG(Persistence,Error, "Client used unknown namespace {} while trying to remove rows in database {}", + LOG(persist,Error, "Client used unknown namespace {} while trying to remove rows in database {}", request.ns(), me->db); response.set_result ( RemoveResponse::NO_SUCH_NS); @@ -184,7 +184,7 @@ void PersistenceServiceServer::remove(const RemoveRequest& request, for (auto &k : request.key()) { if (keys.count(k)) { - LOG(Persistence,Error, "Client used duplicate key {} while trying to remove rows in {}/{}", + LOG(persist,Error, "Client used duplicate key {} while trying to remove rows in {}/{}", k,me->db,request.ns()); response.set_result ( RemoveResponse::DUPLICATE_KEY); reply(response); @@ -194,7 +194,7 @@ void PersistenceServiceServer::remove(const RemoveRequest& request, keys.insert(k); if (k.empty()) { - LOG(Persistence,Error, "Client used empty key while trying to remove rows in {}/{}", + LOG(persist,Error, "Client used empty key while trying to remove rows in {}/{}", me->db,request.ns()); response.set_result ( RemoveResponse::EMPTY_KEY); reply(response); @@ -202,7 +202,7 @@ void PersistenceServiceServer::remove(const RemoveRequest& request, } if (ns_rec.data.find(k) == ns_rec.data.end()) { - LOG(Persistence,Error, "Client tried to remove unknown row with key {} in {}/{}", + LOG(persist,Error, "Client tried to remove unknown row with key {} in {}/{}", k, me->db, request.ns()); response.set_result ( RemoveResponse::NO_SUCH_KEY); reply(response); @@ -223,18 +223,18 @@ void PersistenceServiceServer::remove(const RemoveRequest& request, response.set_result ( RemoveResponse::OK); reply(response); - LOG(Persistence,Diag, "Successfully removed {} rows from {}/{}", keys.size(),me->db,request.ns()); + LOG(persist,Diag, "Successfully removed {} rows from {}/{}", keys.size(),me->db,request.ns()); } void PersistenceServiceServer::remove_all(const RemoveAllRequest& request, const std::function& reply) { - LOG(Persistence,Diag, "Removing all rows from {}/{}", me->db,request.ns()); + LOG(persist,Diag, "Removing all rows from {}/{}", me->db,request.ns()); RemoveResponse response; if (request.ns().empty()) { - LOG(Persistence,Error, "Client used empty namespace while trying to remove all rows in database {}", + LOG(persist,Error, "Client used empty namespace while trying to remove all rows in database {}", me->db); response.set_result ( RemoveResponse::EMPTY_NS); reply(response); @@ -243,7 +243,7 @@ void PersistenceServiceServer::remove_all(const RemoveAllRequest& request, auto it = me->data.find(request.ns()); if (it == me->data.end()) { - LOG(Persistence,Error, "Client used unknown namespace {} while trying to remove all rows in database {}", + LOG(persist,Error, "Client used unknown namespace {} while trying to remove all rows in database {}", request.ns(), me->db); response.set_result ( RemoveResponse::NO_SUCH_NS); @@ -266,17 +266,17 @@ void PersistenceServiceServer::remove_all(const RemoveAllRequest& request, response.set_result ( RemoveResponse::OK); reply(response); - LOG(Persistence,Diag, "Successfully removed all {} rows from {}/{}", keys.size(),me->db,request.ns()); + LOG(persist,Diag, "Successfully removed all {} rows from {}/{}", keys.size(),me->db,request.ns()); } void PersistenceServiceServer::store(const StoreRequest& request, const std::function& reply) { - LOG(Persistence,Diag, "Storing {} rows in {}/{}", request.record().size(), me->db,request.ns()); + LOG(persist,Diag, "Storing {} rows in {}/{}", request.record().size(), me->db,request.ns()); StoreResponse response; if (request.ns().empty()) { - LOG(Persistence,Error, "Client used empty namespace while trying to store rows in database {}", me->db); + LOG(persist,Error, "Client used empty namespace while trying to store rows in database {}", me->db); response.set_result ( StoreResponse::EMPTY_NS); reply(response); return; @@ -296,7 +296,7 @@ void PersistenceServiceServer::store(const StoreRequest& request, auto const &k = r.key(); if (keys.count(k)) { - LOG(Persistence,Error, "Client used duplicate key {} while trying to store rows in {}/{}", + LOG(persist,Error, "Client used duplicate key {} while trying to store rows in {}/{}", k,me->db,request.ns()); response.set_result ( StoreResponse::DUPLICATE_KEY); reply(response); @@ -304,7 +304,7 @@ void PersistenceServiceServer::store(const StoreRequest& request, } if (k.empty()) { - LOG(Persistence,Error, "Client used empty key while trying to store rows in {}/{}", + LOG(persist,Error, "Client used empty key while trying to store rows in {}/{}", me->db,request.ns()); response.set_result ( StoreResponse::EMPTY_KEY); reply(response); @@ -332,7 +332,7 @@ void PersistenceServiceServer::store(const StoreRequest& request, rec->publish(&insert,&update,nullptr); response.set_result ( StoreResponse::OK); reply(response); - LOG(Persistence,Diag, "Successfully stored {} rows in {}/{}", request.record().size(),me->db,request.ns()); + LOG(persist,Diag, "Successfully stored {} rows in {}/{}", request.record().size(),me->db,request.ns()); } }} diff --git a/src/server/sparkd/persistence/SqliteStore.cpp b/src/server/sparkd/persistence/SqliteStore.cpp index 2b4d34ff7..30ee8d135 100644 --- a/src/server/sparkd/persistence/SqliteStore.cpp +++ b/src/server/sparkd/persistence/SqliteStore.cpp @@ -63,7 +63,7 @@ void SqliteStore::init_db() { bts_assert(boost::filesystem::create_directories(parent)); if(!boost::filesystem::exists(path)) { - LOG (Persistence,Warn, "{} database does not exist yet. Creating it at {}", + LOG (persist,Warn, "{} database does not exist yet. Creating it at {}", me->db, path.string()); me->conn = utils::open_db(path.c_str()); diff --git a/src/server/sparkd/securities/SecurityDB.cpp b/src/server/sparkd/securities/SecurityDB.cpp index cb840c474..8fe3942d5 100644 --- a/src/server/sparkd/securities/SecurityDB.cpp +++ b/src/server/sparkd/securities/SecurityDB.cpp @@ -52,7 +52,7 @@ SecurityDB::SecurityDB () : me (new PImpl()) me->known_securities[k] = std::make_unique(r.second); } else - LOG(Persistence,Error, + LOG(persist,Error, "Could not retrieve security with key {} from storage. " "This security will be ignored " "Security string is: {} ", kvp.first, kvp.second); @@ -76,7 +76,7 @@ void SecurityDB::store_if_new(api::Security const&sec) auto is_there = me->store->retrieve_one(sec_ns,ks); if (is_there.first) { - LOG(Persistence,Error, + LOG(persist,Error, "Updating a security object in disk, this is not expected." "Security {} will be updated with {}", ks, vs); me->store->update(sec_ns,ks,vs);