11 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
12 #include <spdlog/spdlog.h>
14 #if defined(SPDLOG_VER_MAJOR) && SPDLOG_VER_MAJOR >= 1
15 #include <spdlog/sinks/basic_file_sink.h>
17 #include <spdlog/sinks/file_sinks.h>
20 #include <spdlog/fmt/ostr.h>
22 #include <dpsim-models/Definitions.h>
23 #include <dpsim-models/MathUtils.h>
30 using Level = spdlog::level::level_enum;
31 using Log = std::shared_ptr<spdlog::logger>;
34 static Log create(
const std::string &name, Level filelevel = Level::info,
35 Level clilevel = Level::off);
41 static String prefix();
42 static String logDir();
47 static Log get(
const std::string &name, Level filelevel = Level::info,
48 Level clilevel = Level::off);
50 static void setLogLevel(std::shared_ptr<spdlog::logger> logger,
53 static void setLogPattern(std::shared_ptr<spdlog::logger> logger,
57 static String matrixToString(
const Matrix &mat);
58 static String matrixCompToString(
const MatrixComp &mat);
59 static String sparseMatrixToString(
const SparseMatrix &mat);
60 static String sparseMatrixCompToString(
const SparseMatrixComp &mat);
61 static String phasorMatrixToString(
const MatrixComp &mat);
62 static String phasorToString(
const Complex &num);
63 static String complexToString(
const Complex &num);
64 static String realToString(
const Real &num);
66 static String getCSVColumnNames(std::vector<String> names);
67 static String getCSVLineFromData(Real time, Real data);
68 static String getCSVLineFromData(Real time,
const Matrix &data);
69 static String getCSVLineFromData(Real time,
const MatrixComp &data);
static void setLogDir(String path)
Set env variable CPS_LOG_DIR and overwrite.