FlightGear next
logger.hxx
Go to the documentation of this file.
1// logger.hxx - log properties.
2// Written by David Megginson, started 2002.
3//
4// This file is in the Public Domain, and comes with no warranty.
5
6#ifndef __LOGGER_HXX
7#define __LOGGER_HXX 1
8
9#include <memory>
10#include <vector>
11
12#include <simgear/compiler.h>
13#include <simgear/io/iostreams/sgstream.hxx>
14#include <simgear/structure/subsystem_mgr.hxx>
15#include <simgear/props/props.hxx>
16
20class FGLogger : public SGSubsystem
21{
22public:
23 // Subsystem API.
24 void bind() override;
25 void init() override;
26 void reinit() override;
27 void unbind() override;
28 void update(double dt) override;
29
30 // Subsystem identification.
31 static const char* staticSubsystemClassId() { return "logger"; }
32
33private:
37 struct Log {
38 Log ();
39
40 std::vector<SGPropertyNode_ptr> nodes;
41 std::unique_ptr<sg_ofstream> output;
42 long interval_ms;
43 double last_time_ms;
44 char delimiter;
45 };
46
47 std::vector< std::unique_ptr<Log> > _logs;
48};
49
50#endif // __LOGGER_HXX
Log any property values to any number of CSV files.
Definition logger.hxx:21
void init() override
Definition logger.cxx:32
void reinit() override
Definition logger.cxx:120
static const char * staticSubsystemClassId()
Definition logger.hxx:31
void bind() override
Definition logger.cxx:127
void update(double dt) override
Definition logger.cxx:137
void unbind() override
Definition logger.cxx:132