Pull log naming code out of binary_log_writer and use in new logger
Flatbuffer logs will now be at /media/sda1/fbs_log-XYZ.
Change-Id: I7cfbc797cf8da415ff065387bf1867885c67c65d
diff --git a/aos/events/logging/BUILD b/aos/events/logging/BUILD
index f2012da..553016c 100644
--- a/aos/events/logging/BUILD
+++ b/aos/events/logging/BUILD
@@ -52,6 +52,7 @@
"//aos:configuration",
"//aos:init",
"//aos/events:shm_event_loop",
+ "//aos/logging:log_namer",
"@com_github_gflags_gflags//:gflags",
"@com_github_google_glog//:glog",
],
diff --git a/aos/events/logging/logger_main.cc b/aos/events/logging/logger_main.cc
index 6049f41..74e9f65 100644
--- a/aos/events/logging/logger_main.cc
+++ b/aos/events/logging/logger_main.cc
@@ -1,14 +1,11 @@
#include "aos/configuration.h"
#include "aos/events/logging/logger.h"
#include "aos/events/shm_event_loop.h"
+#include "aos/logging/log_namer.h"
#include "aos/init.h"
#include "gflags/gflags.h"
#include "glog/logging.h"
-// TODO(james): Write code for managing logfile names.
-DEFINE_string(logfile, "/media/sda1/logfile.bfbs",
- "Name of the logfile to write to.");
-
DEFINE_string(config, "config.json", "Config file to use.");
int main(int argc, char *argv[]) {
@@ -25,7 +22,7 @@
aos::ShmEventLoop event_loop(&config.message());
- aos::logger::DetachedBufferWriter writer(FLAGS_logfile);
+ aos::logger::DetachedBufferWriter writer(aos::logging::GetLogName("fbs_log"));
aos::logger::Logger logger(&writer, &event_loop);
event_loop.Run();