Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f2e948c

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Give log categories full names
1 parent c26746f commit f2e948c

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed

SimulationRuntime/cpp/Core/SimController/SimManager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,25 +265,25 @@ void SimManager::runSimulation()
265265
#endif
266266
try
267267
{
268-
LOGGER_WRITE("SimManager: Start simulation at t = " + to_string(_tStart), LC_SOLV, LL_INFO);
268+
LOGGER_WRITE("SimManager: Start simulation at t = " + to_string(_tStart), LC_SOLVER, LL_INFO);
269269
runSingleProcess();
270270
// Measure time; Output SimInfos
271271
ISolver::SOLVERSTATUS status = _solver->getSolverStatus();
272272
if ((status & ISolver::DONE) || (status & ISolver::USER_STOP))
273273
{
274-
//LOGGER_WRITE("SimManager: Simulation done at t = " + to_string(_tEnd), LC_SOLV, LL_INFO);
274+
//LOGGER_WRITE("SimManager: Simulation done at t = " + to_string(_tEnd), LC_SOLVER, LL_INFO);
275275
writeProperties();
276276
}
277277
}
278278
catch (std::exception & ex)
279279
{
280280
LOGGER_WRITE("SimManager: Simulation stopped with errors before t = " +
281-
to_string(_tEnd), LC_SOLV, LL_ERROR);
282-
LOGGER_WRITE("SimManager: " + string(ex.what()), LC_SOLV, LL_ERROR);
281+
to_string(_tEnd), LC_SOLVER, LL_ERROR);
282+
LOGGER_WRITE("SimManager: " + string(ex.what()), LC_SOLVER, LL_ERROR);
283283
writeProperties();
284284
// rethrow with suppress depending on logger setting to not appear twice
285285
throw ModelicaSimulationError(SIMMANAGER, ex.what(), "",
286-
LOGGER_IS_SET(LC_SOLV, LL_ERROR));
286+
LOGGER_IS_SET(LC_SOLVER, LL_ERROR));
287287
}
288288
#ifdef RUNTIME_PROFILING
289289
if (MeasureTime::getInstance() != NULL)
@@ -302,14 +302,14 @@ void SimManager::stopSimulation()
302302
void SimManager::writeProperties()
303303
{
304304
// declaration for Logging
305-
std::pair<LogCategory, LogLevel> logM = Logger::getLogMode(LC_SOLV, LL_INFO);
305+
std::pair<LogCategory, LogLevel> logM = Logger::getLogMode(LC_SOLVER, LL_INFO);
306306

307307
LOGGER_WRITE_TUPLE("SimManager: Simulation stop time: " + to_string(_tEnd), logM);
308308
//LOGGER_WRITE("Rechenzeit in Sekunden: " + to_string>(_tClockEnd-_tClockStart), logM);
309309

310-
LOGGER_WRITE_BEGIN("Simulation info from solver:", LC_SOLV, LL_INFO);
310+
LOGGER_WRITE_BEGIN("Simulation info from solver:", LC_SOLVER, LL_INFO);
311311
_solver->writeSimulationInfo();
312-
LOGGER_WRITE_END(LC_SOLV, LL_INFO);
312+
LOGGER_WRITE_END(LC_SOLVER, LL_INFO);
313313
/*
314314
// Zeit
315315
if(_settings->_globalSettings->bEndlessSim)
@@ -566,7 +566,7 @@ void SimManager::runSingleProcess()
566566

567567
/* Logs temporarily disabled
568568
BOOST_LOG_SEV(simmgr_lg::get(), simmgr_normal) <<"Run single process." ; */
569-
LOGGER_WRITE("SimManager: Run single process",LC_SOLV,LL_DEBUG);
569+
LOGGER_WRITE("SimManager: Run single process", LC_SOLVER, LL_DEBUG);
570570

571571
memset(_timeEventCounter, 0, _dimtimeevent * sizeof(int));
572572
computeEndTimes(tStopsSub);

SimulationRuntime/cpp/Core/System/ContinuousEvents.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool ContinuousEvents::startEventIteration(bool& state_vars_reinitialized)
103103
bool crestart =false;
104104
if (dim > 0)
105105
{
106-
LOGGER_WRITE_VECTOR("conditions", _conditions1, dim, LC_EVT, LL_DEBUG);
106+
LOGGER_WRITE_VECTOR("conditions", _conditions1, dim, LC_EVENTS, LL_DEBUG);
107107
crestart = !std::equal(_conditions1, _conditions1 + dim, _conditions0);
108108
}
109109
//check for event clocks

SimulationRuntime/cpp/Core/Utils/extension/logger.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ std::string Logger::getCategory(LogCategory cat) const
8383
return "nls";
8484
case(LC_LS):
8585
return "ls";
86-
case(LC_SOLV):
86+
case(LC_SOLVER):
8787
return "solver";
88-
case(LC_OUT):
88+
case(LC_OUTPUT):
8989
return "output";
90-
case(LC_EVT):
90+
case(LC_EVENTS):
9191
return "events";
92-
case(LC_MOD):
92+
case(LC_MODEL):
9393
return "model";
9494
case(LC_OTHER):
9595
default:

SimulationRuntime/cpp/Core/Utils/extension/measure_time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void MeasureTime::writeToJson()
229229
{
230230
if((*data)[i] == NULL)
231231
{
232-
LOGGER_WRITE("Skipped a measured block in '" + block->first + "' because it is null.", LC_OUT, LL_ERROR);
232+
LOGGER_WRITE("Skipped a measured block in '" + block->first + "' because it is null.", LC_OUTPUT, LL_ERROR);
233233
continue;
234234
}
235235
tmpS = (*data)[i]->serializeToJson();

SimulationRuntime/cpp/Include/Core/SimulationSettings/IGlobalSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using std::string;
2525

2626
#include <vector>
2727

28-
enum LogCategory {LC_INIT = 0, LC_NLS = 1, LC_LS = 2, LC_SOLV = 3, LC_OUT = 4, LC_EVT = 5, LC_OTHER = 6, LC_MOD = 7};
28+
enum LogCategory {LC_INIT = 0, LC_NLS = 1, LC_LS = 2, LC_SOLVER = 3, LC_OUTPUT = 4, LC_EVENTS = 5, LC_OTHER = 6, LC_MODEL = 7};
2929
enum LogLevel {LL_ERROR = 0, LL_WARNING = 1, LL_INFO = 2, LL_DEBUG = 3};
3030
enum LogFormat {LF_TXT = 0, LF_XML = 1};
3131
enum LogOMEdit {LOG_EVENTS = 0, LOG_INIT, LOG_LS, LOG_NLS, LOG_SOLVER, LOG_STATS};

SimulationRuntime/cpp/SimCoreFactory/OMCFactory/OMCFactory.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ static LogSettings initializeLogger(const po::variables_map& vm)
7474
{
7575
map<string, LogCategory> logCatMap = MAP_LIST_OF
7676
"init", LC_INIT MAP_LIST_SEP "nls", LC_NLS MAP_LIST_SEP
77-
"ls", LC_LS MAP_LIST_SEP "solver", LC_SOLV MAP_LIST_SEP
78-
"output", LC_OUT MAP_LIST_SEP "events", LC_EVT MAP_LIST_SEP
79-
"model", LC_MOD MAP_LIST_SEP "other", LC_OTHER MAP_LIST_END;
77+
"ls", LC_LS MAP_LIST_SEP "solver", LC_SOLVER MAP_LIST_SEP
78+
"output", LC_OUTPUT MAP_LIST_SEP "events", LC_EVENTS MAP_LIST_SEP
79+
"model", LC_MODEL MAP_LIST_SEP "other", LC_OTHER MAP_LIST_END;
8080
map<string, LogLevel> logLvlMap = MAP_LIST_OF
8181
"error", LL_ERROR MAP_LIST_SEP "warning", LL_WARNING MAP_LIST_SEP
8282
"info", LL_INFO MAP_LIST_SEP "debug", LL_DEBUG MAP_LIST_END;
@@ -109,7 +109,7 @@ static LogSettings initializeLogger(const po::variables_map& vm)
109109
}
110110
switch (logOMEdit) {
111111
case LOG_EVENTS:
112-
logSettings.modes[LC_EVT] = LL_DEBUG;
112+
logSettings.modes[LC_EVENTS] = LL_DEBUG;
113113
break;
114114
case LOG_INIT:
115115
logSettings.modes[LC_INIT] = LL_DEBUG;
@@ -121,11 +121,11 @@ static LogSettings initializeLogger(const po::variables_map& vm)
121121
logSettings.modes[LC_NLS] = LL_DEBUG;
122122
break;
123123
case LOG_SOLVER:
124-
logSettings.modes[LC_SOLV] = LL_DEBUG;
124+
logSettings.modes[LC_SOLVER] = LL_DEBUG;
125125
//case LOG_STATS:
126126
default:
127-
if (logSettings.modes[LC_SOLV] < LL_INFO)
128-
logSettings.modes[LC_SOLV] = LL_INFO;
127+
if (logSettings.modes[LC_SOLVER] < LL_INFO)
128+
logSettings.modes[LC_SOLVER] = LL_INFO;
129129
}
130130
}
131131
}
@@ -150,7 +150,7 @@ static LogSettings initializeLogger(const po::variables_map& vm)
150150
}
151151
}
152152

153-
if (vm.count("warn-all")) {
153+
if (vm.count("warn-all") && vm["warn-all"].as<bool>()) {
154154
for (int i = 0; i < logSettings.modes.size(); i++)
155155
if (logSettings.modes[i] < LL_WARNING)
156156
logSettings.modes[i] = LL_WARNING;

SimulationRuntime/cpp/Solver/CVode/CVode.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ void Cvode::initialize()
322322

323323
_cvode_initialized = true;
324324

325-
LOGGER_WRITE("Cvode: initialized",LC_SOLV,LL_DEBUG);
325+
LOGGER_WRITE("Cvode: initialized", LC_SOLVER, LL_DEBUG);
326326
}
327327
}
328328

@@ -962,12 +962,12 @@ void Cvode::writeSimulationInfo()
962962

963963
flag = CVodeGetNonlinSolvStats(_cvodeMem, &nni, &ncfn);
964964

965-
LOGGER_WRITE("Cvode: number steps = " + to_string(nst), LC_SOLV, LL_INFO);
966-
LOGGER_WRITE("Cvode: function evaluations 'f' = " + to_string(nfe), LC_SOLV, LL_INFO);
967-
LOGGER_WRITE("Cvode: linear solver setups 'nsetups' = " + to_string(nsetups), LC_SOLV, LL_INFO);
968-
LOGGER_WRITE("Cvode: nonlinear iterations 'nni' = " + to_string(nni), LC_SOLV, LL_INFO);
969-
LOGGER_WRITE("Cvode: convergence failures 'ncfn' = " + to_string(ncfn), LC_SOLV, LL_INFO);
970-
LOGGER_WRITE("Cvode: number of evaluateODE calls 'eODE' = " + to_string(_numberOfOdeEvaluations), LC_SOLV, LL_INFO);
965+
LOGGER_WRITE("Cvode: number steps = " + to_string(nst), LC_SOLVER, LL_INFO);
966+
LOGGER_WRITE("Cvode: function evaluations 'f' = " + to_string(nfe), LC_SOLVER, LL_INFO);
967+
LOGGER_WRITE("Cvode: linear solver setups 'nsetups' = " + to_string(nsetups), LC_SOLVER, LL_INFO);
968+
LOGGER_WRITE("Cvode: nonlinear iterations 'nni' = " + to_string(nni), LC_SOLVER, LL_INFO);
969+
LOGGER_WRITE("Cvode: convergence failures 'ncfn' = " + to_string(ncfn), LC_SOLVER, LL_INFO);
970+
LOGGER_WRITE("Cvode: number of evaluateODE calls 'eODE' = " + to_string(_numberOfOdeEvaluations), LC_SOLVER, LL_INFO);
971971

972972
//// Solver
973973
//outputStream << "\nSolver: " << getName()

SimulationRuntime/cpp/Solver/IDA/IDA.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <Core/ModelicaDefine.h>
2-
#include <Core/Modelica.h>
2+
#include <Core/Modelica.h>
33
#include <Solver/IDA/IDA.h>
44
#include <Core/Math/Functions.h>
55

@@ -1073,12 +1073,12 @@ void Ida::writeSimulationInfo()
10731073

10741074
flag = IDAGetNonlinSolvStats(_idaMem, &nni, &ncfn);
10751075

1076-
LOGGER_WRITE("Cvode: number steps = " + to_string(nst), LC_SOLV, LL_INFO);
1077-
LOGGER_WRITE("Cvode: function evaluations 'f' = " + to_string(nfe), LC_SOLV, LL_INFO);
1078-
LOGGER_WRITE("Cvode: error test failures 'netf' = " + to_string(netfS), LC_SOLV, LL_INFO);
1079-
LOGGER_WRITE("Cvode: linear solver setups 'nsetups' = " + to_string(nsetups), LC_SOLV, LL_INFO);
1080-
LOGGER_WRITE("Cvode: nonlinear iterations 'nni' = " + to_string(nni), LC_SOLV, LL_INFO);
1081-
LOGGER_WRITE("Cvode: convergence failures 'ncfn' = " + to_string(ncfn), LC_SOLV, LL_INFO);
1076+
LOGGER_WRITE("Cvode: number steps = " + to_string(nst), LC_SOLVER, LL_INFO);
1077+
LOGGER_WRITE("Cvode: function evaluations 'f' = " + to_string(nfe), LC_SOLVER, LL_INFO);
1078+
LOGGER_WRITE("Cvode: error test failures 'netf' = " + to_string(netfS), LC_SOLVER, LL_INFO);
1079+
LOGGER_WRITE("Cvode: linear solver setups 'nsetups' = " + to_string(nsetups), LC_SOLVER, LL_INFO);
1080+
LOGGER_WRITE("Cvode: nonlinear iterations 'nni' = " + to_string(nni), LC_SOLVER, LL_INFO);
1081+
LOGGER_WRITE("Cvode: convergence failures 'ncfn' = " + to_string(ncfn), LC_SOLVER, LL_INFO);
10821082
}
10831083

10841084
int Ida::check_flag(void *flagvalue, const char *funcname, int opt)

0 commit comments

Comments
 (0)