Program Listing for File JSONLogger.h
↰ Return to documentation for file (include/flamegpu/io/JSONLogger.h
)
#ifndef INCLUDE_FLAMEGPU_IO_JSONLOGGER_H_
#define INCLUDE_FLAMEGPU_IO_JSONLOGGER_H_
#include <string>
#include <typeindex>
#include "flamegpu/io/Logger.h"
#include "flamegpu/detail/Any.h"
namespace flamegpu {
struct RunLog;
struct StepLogFrame;
struct ExitLogFrame;
struct LogFrame;
class RunPlan;
namespace io {
class JSONLogger : public Logger{
public:
JSONLogger(const std::string &outPath, bool prettyPrint, bool truncateFile);
void log(const RunLog &log, const RunPlan &plan, bool logSteps = true, bool logExit = true, bool logStepTime = false, bool logExitTime = false) const override;
void log(const RunLog &log, bool logConfig = true, bool logSteps = true, bool logExit = true, bool logStepTime = false, bool logExitTime = false) const override;
private:
void logCommon(const RunLog &log, const RunPlan *plan, bool logConfig, bool logSteps, bool logExit, bool logStepTime, bool logExitTime) const;
template<typename T>
void logCommon(T &writer, const RunLog &log, const RunPlan *plan, bool logConfig, bool logSteps, bool logExit, bool logStepTime, bool logExitTime) const;
template<typename T>
void logConfig(T &writer, const RunLog &log) const;
template<typename T>
void logConfig(T &writer, const RunPlan &plan) const;
template<typename T>
void logPerformanceSpecs(T& writer, const RunLog& log) const;
template<typename T>
void logSteps(T &writer, const RunLog &log, bool logTime) const;
template<typename T>
void logExit(T &writer, const RunLog &log, bool logTime) const;
template<typename T>
void writeLogFrame(T &writer, const StepLogFrame&log, bool logTime) const;
template<typename T>
void writeLogFrame(T& writer, const ExitLogFrame& log, bool logTime) const;
template<typename T>
void writeCommonLogFrame(T& writer, const LogFrame& log) const;
template<typename T>
void writeAny(T &writer, const detail::Any &value, unsigned int elements = 1) const;
std::string out_path;
bool prettyPrint;
bool truncateFile;
};
} // namespace io
} // namespace flamegpu
#endif // INCLUDE_FLAMEGPU_IO_JSONLOGGER_H_