|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
21 bool yarp::os::impl::LogForwarder::started{
false};
31 yarp::os::impl::LogForwarder::LogForwarder()
33 char hostname[HOST_NAME_MAX];
38 outputPort.setWriteOnly();
39 std::string logPortName =
"/log/" + std::string(hostname) +
"/" + processInfo.
name.substr(processInfo.
name.find_last_of(
"\\/") + 1) +
"/" + std::to_string(processInfo.
pid);
40 if (!outputPort.open(logPortName)) {
41 printf(
"LogForwarder error while opening port %s\n", logPortName.c_str());
43 outputPort.enableBackgroundWrite(
true);
44 outputPort.addOutput(
"/yarplogger",
"fast_tcp");
54 std::string port =
"[" + outputPort.getName() +
"]";
64 std::ostringstream ost;
68 ost <<
"(level INFO)";
78 fw.outputPort.
close();
void close() override
Stop port activity.
A simple collection of objects that can be described and transmitted in a portable way.
void clear()
Empties the bottle of any objects it contains.
static LogForwarder & getInstance()
double now()
Return the current time in seconds, relative to an arbitrary starting point.
static double nowSystem()
static void delaySystem(double seconds)
static ProcessInfo getProcessInfo(int pid=0)
gets the operating system process information given by its PID.
void gethostname(char *hostname, size_t size)
Portable wrapper for the gethostname() function.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
static bool isNetworkInitialized()
void forward(const std::string &message)
static std::string toString(int x)
The ProcessInfo struct provides the operating system process information.
bool isSystemClock()
Check if YARP is providing system time.
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool isWriting() override
Report whether the port is currently writing data.