Cleaned MD use of logs.

This commit is contained in:
Pedro Pinto committed 2017-10-09 22:24:21 +00:00
1 parent 36cee53c41
commit b9a6c078aa
5 files changed
+19 -14

No files matched your search

-1
View File
@@ -88,7 +88,6 @@ message CMEOptions
// New settings
}
optional string onixs_license = 1 [default = "{default}"];
optional string onixs_log_path = 2 [default = "/var/log/bts/onixs"];
repeated CMEChannel channel = 3;
repeated FeedEngineSettings feed_engine = 5;
+3 -11
View File
@@ -96,19 +96,11 @@ std::ifstream::pos_type filesize(std::string const&filename)
}
}
boost::filesystem::path log_path ()
{
auto store_root = os::bts_data_path();
std::string base_path = store_root;
boost::filesystem::path result = utils::normalize_data_path (base_path);
result /= "logging";
result /= "log";
return result;
}
Sink file_sink() {
auto f= formatter();
auto path = log_path();
auto path = log_path();
path /= "log";
auto parent = path.parent_path();
if (!boost::filesystem::is_directory(parent))
+12 -1
View File
@@ -33,6 +33,15 @@ typename M::const_iterator find_key(M const&m, typename M::mapped_type const &v)
return m.end();
}
boost::filesystem::path log_path ()
{
auto store_root = os::bts_data_path();
std::string base_path = store_root;
boost::filesystem::path result = utils::normalize_data_path (base_path);
result /= "logging";
return result;
}
void start_default_logging_thread()
{
_default_logger_hub.start();
@@ -85,7 +94,9 @@ void configure_logging(bts::config::Logging const&cfg)
{log::Api,"Api"},
{log::Persistence,"Persistence"},
{log::User,"User"},
{log::OrderMan,"OrderMan"}};
{log::OrderMan,"OrderMan"},
{log::Latency,"Latency"},
};
real_cfg.sinks["console"] =
std::make_pair (console_sink(),get_filter(real_cfg,cfg.console()));
+3
View File
@@ -32,6 +32,7 @@ constexpr log::Subsystem Api {MarketData.ordinal+1};
constexpr log::Subsystem Persistence{Api.ordinal+1};
constexpr log::Subsystem User {Persistence.ordinal+1};
constexpr log::Subsystem OrderMan {User.ordinal+1};
constexpr log::Subsystem Latency {OrderMan.ordinal+1};
struct LoggerHandle {
LoggerHandle(LoggerHandle const&) = delete;
@@ -63,6 +64,8 @@ private:
std::atomic<bool> _done;
};
boost::filesystem::path log_path ();
#define LOG(subsystem,level,...) bts::log::_thread_logger.logger->enqueue(bts::log::subsystem,level,__FILE__,__LINE__,__VA_ARGS__)
#define LOG_ONCE_MAYBE(subsystem,level,...) bts::log::_thread_logger.logger->enqueue_once_maybe(log::subsystem,level,__FILE__,__LINE__,__VA_ARGS__)
+1 -1
View File
@@ -138,7 +138,7 @@ void replay_file(const std::string& filename, IRelayWriter& writer, int32_t nagg
replay_recording(in, writer, naggle_ms);
}
else {
cout << "Cannot read file: " << filename;
LOG(MarketData,Diag, "Cannot read file {}", filename);
}
}