blob: 74e9f65f184b4a169359b876aa944726bc04d4be [file] [log] [blame]
James Kuszmaul38735e82019-12-07 16:42:06 -08001#include "aos/configuration.h"
2#include "aos/events/logging/logger.h"
3#include "aos/events/shm_event_loop.h"
James Kuszmaul011b67a2019-12-15 12:52:34 -08004#include "aos/logging/log_namer.h"
James Kuszmaul38735e82019-12-07 16:42:06 -08005#include "aos/init.h"
6#include "gflags/gflags.h"
7#include "glog/logging.h"
8
James Kuszmaul38735e82019-12-07 16:42:06 -08009DEFINE_string(config, "config.json", "Config file to use.");
10
11int main(int argc, char *argv[]) {
12 gflags::SetUsageMessage(
13 "This program provides a simple logger binary that logs all SHMEM data "
14 "directly to a file specified at the command line. It does not manage "
15 "filenames, so it will just crash if you attempt to overwrite an "
16 "existing file, and the user must specify the logfile manually at the "
17 "command line.");
18 aos::InitGoogle(&argc, &argv);
19
20 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
21 aos::configuration::ReadConfig(FLAGS_config);
22
23 aos::ShmEventLoop event_loop(&config.message());
24
James Kuszmaul011b67a2019-12-15 12:52:34 -080025 aos::logger::DetachedBufferWriter writer(aos::logging::GetLogName("fbs_log"));
James Kuszmaul38735e82019-12-07 16:42:06 -080026 aos::logger::Logger logger(&writer, &event_loop);
27
28 event_loop.Run();
29
30 aos::Cleanup();
31 return 0;
32}