org.javafmi.framework.Logger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fmu-framework Show documentation
Show all versions of fmu-framework Show documentation
javaFMI is a Java Library for the functional mock-up interface (or FMI). FMI defines a standardized interface to be used in computer simulations. The FMI Standard has beed developed by a large number of software companies and research centers that have worked in a cooperation project under the name of MODELISAR. This library addresses the connection of a java application with a FMU (functional mock-up unit).
/*
* Copyright 2013-2016 SIANI - ULPGC
*
* This File is part of JavaFMI Project
*
* JavaFMI Project is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* JavaFMI Project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JavaFMI. If not, see .
*/
package org.javafmi.framework;
import java.io.PrintStream;
public class Logger {
private final String instanceName;
private final PrintStream outStream;
public Logger(String instanceName, PrintStream outStream) {
this.instanceName = instanceName;
this.outStream = outStream;
}
public void info(String message) {
log("INFO", message);
}
public void warning(String message) {
log("WARNING", message);
}
public void error(String message) {
log("ERROR", message);
}
private void log(String category, String message) {
outStream.println(instanceName + ":" + category + ":" + message);
}
}