log 3rd party component versions at startup
Dieser Commit ist enthalten in:
Ursprung
ec58e35463
Commit
278b754bc1
38
server/src/lua/getversion.hpp
Normale Datei
38
server/src/lua/getversion.hpp
Normale Datei
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* server/src/lua/getversion.hpp
|
||||
*
|
||||
* This file is part of the traintastic source code.
|
||||
*
|
||||
* Copyright (C) 2022 Reinder Feenstra
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef TRAINTASTIC_SERVER_LUA_GETVERSION_HPP
|
||||
#define TRAINTASTIC_SERVER_LUA_GETVERSION_HPP
|
||||
|
||||
#include <lua.hpp>
|
||||
|
||||
namespace Lua {
|
||||
|
||||
inline std::string_view getVersion()
|
||||
{
|
||||
const std::string_view ident{lua_ident};
|
||||
return ident.substr(13, ident.find('$', 13) - 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -32,6 +32,7 @@
|
||||
#include "type.hpp"
|
||||
#include "enums.hpp"
|
||||
#include "sets.hpp"
|
||||
#include "getversion.hpp"
|
||||
#include <version.hpp>
|
||||
#include <traintastic/utils/str.hpp>
|
||||
#include "../world/world.hpp"
|
||||
@ -211,8 +212,7 @@ SandboxPtr Sandbox::create(Script& script)
|
||||
lua_setfield(L, -2, "VERSION_PATCH");
|
||||
|
||||
// set LUA_VERSION
|
||||
const std::string_view ident{lua_ident};
|
||||
push(L, ident.substr(13, ident.find('$', 13) - 14));
|
||||
push(L, getVersion());
|
||||
lua_setfield(L, -2, "LUA_VERSION");
|
||||
|
||||
// add world:
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <boost/uuid/nil_generator.hpp>
|
||||
#include <boost/uuid/string_generator.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <archive.h>
|
||||
#include <version.hpp>
|
||||
#include <traintastic/utils/str.hpp>
|
||||
#include "../core/eventloop.hpp"
|
||||
@ -35,6 +36,7 @@
|
||||
#include "../world/worldloader.hpp"
|
||||
#include "../log/log.hpp"
|
||||
#include "../log/logmessageexception.hpp"
|
||||
#include "../lua/getversion.hpp"
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
@ -153,7 +155,13 @@ bool Traintastic::importWorld(const std::vector<std::byte>& worldData)
|
||||
|
||||
Traintastic::RunStatus Traintastic::run()
|
||||
{
|
||||
static const std::string boostVersion = std::string("boost ").append(std::to_string(BOOST_VERSION / 100000)).append(".").append(std::to_string(BOOST_VERSION / 100 % 100)).append(".").append(std::to_string(BOOST_VERSION % 100));
|
||||
Log::log(*this, LogMessage::I1001_TRAINTASTIC_VX, std::string_view{TRAINTASTIC_VERSION_FULL});
|
||||
Log::log(*this, LogMessage::I1006_X, boostVersion);
|
||||
Log::log(*this, LogMessage::I1007_X, std::string_view{"nlohmann::json " STR(NLOHMANN_JSON_VERSION_MAJOR) "." STR(NLOHMANN_JSON_VERSION_MINOR) "." STR(NLOHMANN_JSON_VERSION_PATCH)});
|
||||
Log::log(*this, LogMessage::I1008_X, std::string_view{archive_version_details()});
|
||||
//! \todo Add tcb::span version when available, see https://github.com/tcbrindle/span/issues/33
|
||||
Log::log(*this, LogMessage::I9002_X, Lua::getVersion());
|
||||
|
||||
settings = std::make_shared<Settings>(m_dataDir);
|
||||
Attributes::setEnabled(restart, settings->allowClientServerRestart);
|
||||
|
||||
@ -69,12 +69,16 @@ enum class LogMessage : uint32_t
|
||||
I1003_CLIENT_CONNECTED = LogMessageOffset::info + 1003,
|
||||
I1004_CONNECTION_LOST = LogMessageOffset::info + 1004,
|
||||
I1005_BUILDING_WORLD_INDEX = LogMessageOffset::info + 1005,
|
||||
I1006_X = LogMessageOffset::info + 1006, //!< boost version
|
||||
I1007_X = LogMessageOffset::info + 1007, //!< nlohmann::json version
|
||||
I1008_X = LogMessageOffset::info + 1008, //!< LibArchive version
|
||||
I2001_UNKNOWN_LOCO_ADDRESS_X = LogMessageOffset::info + 2001,
|
||||
I2002_HARDWARE_TYPE_X = LogMessageOffset::info + 2002,
|
||||
I2003_FIRMWARE_VERSION_X = LogMessageOffset::info + 2003,
|
||||
I2004_HSI_88_X = LogMessageOffset::info + 2004,
|
||||
I2005_X = LogMessageOffset::info + 2005,
|
||||
I9001_STOPPED_SCRIPT = LogMessageOffset::info + 9001,
|
||||
I9002_X = LogMessageOffset::info + 9002, //!< Lua version
|
||||
I9999_X = LogMessageOffset::info + 9999,
|
||||
|
||||
// Notice:
|
||||
|
||||
@ -330,12 +330,16 @@ message:I1002=Settings file not found, using defaults
|
||||
message:I1003=Client connected
|
||||
message:I1004=Connection lost
|
||||
message:I1005=Building world index
|
||||
message:I1006=%1
|
||||
message:I1007=%1
|
||||
message:I1008=%1
|
||||
message:I2001=Unknown loco address: %1
|
||||
message:I2002=Hardware type: %1
|
||||
message:I2003=Firmware version: %1
|
||||
message:I2004=HSI-88: %1
|
||||
message:I2005=%1
|
||||
message:I9001=Stopped script
|
||||
message:I9002=%1
|
||||
message:I9999=%1
|
||||
message:N1001=Received signal: %1
|
||||
message:N1002=Created new world
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren