Rigs of Rods
2026.01
Soft-body Physics Simulation
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
Loading...
Searching...
No Matches
source
main
scripting
server
ServerScriptLogger.cpp
Go to the documentation of this file.
1
2
// =============================================================================
3
// This file is adopted from rorserver at commit 4a7109ae2d9a081ccfdad8cc696dc54efe49acb3
4
// Changes from the original are marked with "//RIGSOFRODS"
5
// =============================================================================
6
7
/*
8
This file is part of "Rigs of Rods Server" (Relay mode)
9
10
Copyright 2007 Pierre-Michel Ricordel
11
Copyright 2014+ Rigs of Rods Community
12
13
"Rigs of Rods Server" is free software: you can redistribute it
14
and/or modify it under the terms of the GNU General Public License
15
as published by the Free Software Foundation, either version 3
16
of the License, or (at your option) any later version.
17
18
"Rigs of Rods Server" is distributed in the hope that it will
19
be useful, but WITHOUT ANY WARRANTY; without even the implied
20
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
See the GNU General Public License for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
25
*/
26
27
#ifdef USE_ANGELSCRIPT
28
29
#include "
ServerScriptLogger.h
"
30
31
#include "
Application.h
"
// RIGSOFRODS: For App::sys_logs_dir
32
#include "
PlatformUtils.h
"
// RIGSOFRODS: For RoR::PathCombine
33
34
using namespace
RoR
;
35
36
static
Ogre::Log*
sServerLog
=
nullptr
;
37
38
void
Init
()
39
{
40
if
(!
sServerLog
)
41
sServerLog
= Ogre::LogManager::getSingleton().createLog(
RoR::PathCombine
(
App::sys_logs_dir
->getStr(),
"RoRServerScript.log"
));
42
}
43
44
void
Logger::Log
(
ServerLogLevel
level,
const
char
*format, ...)
45
{
46
Init
();
47
48
// Format the message
49
const
int
BUF_LEN = 4000;
// hard limit
50
char
buffer[BUF_LEN] = {};
// zeroed memory
51
va_list args;
52
va_start(args, format);
53
vsnprintf(buffer, BUF_LEN, format, args);
54
va_end(args);
55
// Log the message
56
sServerLog
->logMessage(std::string(buffer));
57
}
58
59
void
Logger::Log
(
ServerLogLevel
level, std::string
const
& msg)
60
{
61
Init
();
62
63
sServerLog
->logMessage(msg);
64
}
65
66
#endif
// USE_ANGELSCRIPT
Application.h
Central state/object manager and communications hub.
PlatformUtils.h
Platform-specific utilities. We use narrow UTF-8 encoded strings as paths. Inspired by http://utf8eve...
sServerLog
static Ogre::Log * sServerLog
Definition
ServerScriptLogger.cpp:36
Init
void Init()
Definition
ServerScriptLogger.cpp:38
ServerScriptLogger.h
ServerLogLevel
ServerLogLevel
Definition
ServerScriptLogger.h:5
RoR::PathCombine
std::string PathCombine(std::string a, std::string b)
Definition
PlatformUtils.h:48
Logger::Log
void Log(ServerLogLevel level, const char *format,...)
Definition
ServerScriptLogger.cpp:44
RoR::App::sys_logs_dir
CVar * sys_logs_dir
Definition
Application.cpp:175
RoR
Definition
AppContext.h:36
Generated on Sun Oct 18 2026 08:40:11 for Rigs of Rods by
1.9.8