OMCompiler/SimulationRuntime/cpp/FMU/FMULogger.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file belongs to the OpenModelica Run-Time System | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings | ||
| 5 | * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights | ||
| 6 | * reserved. | ||
| 7 | * | ||
| 8 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE | ||
| 9 | * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY | ||
| 10 | * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
| 11 | * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL | ||
| 12 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 13 | * | ||
| 14 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License | ||
| 15 | * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs: | ||
| 16 | * http://www.openmodelica.org or https://github.com/OpenModelica/ or | ||
| 17 | * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU | ||
| 18 | * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW | ||
| 19 | * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause. | ||
| 20 | * | ||
| 21 | * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY | ||
| 23 | * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF | ||
| 24 | * OSMC-PL. | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * FMULogger.cpp | ||
| 30 | * | ||
| 31 | * Created on: 04.06.2015 | ||
| 32 | * Author: marcus | ||
| 33 | */ | ||
| 34 | #include <Core/ModelicaDefine.h> | ||
| 35 | #include <Core/Modelica.h> | ||
| 36 | #include <FMU/FactoryExport.h> | ||
| 37 | #include <Core/Utils/extension/logger.hpp> | ||
| 38 | #include <FMU/FMULogger.h> | ||
| 39 | /* | ||
| 40 | #if defined(_MSC_VER) && !defined(RUNTIME_STATIC_LINKING) | ||
| 41 | Logger* Logger::_instance = 0; | ||
| 42 | #endif | ||
| 43 | */ | ||
| 44 | ✗ | FMULogger::FMULogger(fmiCallbackLogger callbackLogger, fmiComponent component, fmiString instanceName) : Logger(LogSettings(LF_FMI), false), | |
| 45 | ✗ | callbackLogger(callbackLogger), component(component), instanceName(instanceName) | |
| 46 | { | ||
| 47 | ✗ | } | |
| 48 | |||
| 49 | ✗ | FMULogger::~FMULogger() | |
| 50 | { | ||
| 51 | ✗ | } | |
| 52 | |||
| 53 | ✗ | void FMULogger::writeInternal(std::string errorMsg, LogCategory cat, LogLevel lvl, LogStructure ls) | |
| 54 | { | ||
| 55 | ✗ | if (ls == LS_END) | |
| 56 | return; | ||
| 57 | |||
| 58 | ✗ | switch(lvl) | |
| 59 | { | ||
| 60 | ✗ | case(LL_ERROR): | |
| 61 | ✗ | callbackLogger(component, instanceName, fmiError, "?", errorMsg.c_str()); | |
| 62 | ✗ | break; | |
| 63 | ✗ | case(LL_WARNING): | |
| 64 | ✗ | callbackLogger(component, instanceName, fmiWarning, "?", errorMsg.c_str()); | |
| 65 | ✗ | break; | |
| 66 | ✗ | case(LL_INFO): | |
| 67 | case(LL_DEBUG): | ||
| 68 | ✗ | callbackLogger(component, instanceName, fmiOK, "?", errorMsg.c_str()); | |
| 69 | ✗ | break; | |
| 70 | ✗ | default: | |
| 71 | ✗ | callbackLogger(component, instanceName, fmiError, "?", errorMsg.c_str()); | |
| 72 | } | ||
| 73 | } | ||
| 74 |