20bool yarp::os::impl::LogForwarder::started{
false};
32void yarp::os::impl::ThreadedPort::ThreadedPort::run()
38 size = messages.size();
40 if (size > 0 && m_port) { process(); }
45void yarp::os::impl::ThreadedPort::process()
78 messages.push_front(bot);
93yarp::os::impl::LogForwarder::LogForwarder()
101 outputPort.setWriteOnly();
102 std::string
logPortName =
"/log/" + std::string(hostname) +
103 "/" + processInfo.
name.substr(processInfo.
name.find_last_of(
"\\/") + 1);
113 outputPort.addOutput(
"/yarplogger",
"fast_tcp");
114 tport.attach(&outputPort);
121 return outputPort.getName();
128 std::string port =
"[" + outputPort.
getName() +
"]";
138 std::ostringstream
ost;
142 ost <<
"(level INFO)";
147 fw.forward(
ost.str());
152 fw.tport.terminate();
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.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A mini-server for performing network communication in the background.
std::string getName() const override
Get name of port.
void close() override
Stop port activity.
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool isWriting() override
Report whether the port is currently writing data.
static bool isNetworkInitialized()
An abstraction for a periodic thread.
bool start()
Call this to start the thread.
Holds the operating system process information.
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 forward(const std::string &message)
std::string getLogPortName()
static LogForwarder & getInstance()
void attach(yarp::os::BufferedPort< yarp::os::Bottle > *port)
void insert(const yarp::os::Bottle &bot)
std::string get_string(const std::string &key, bool *found=nullptr)
Read a string from an environment variable.
std::string to_string(IntegerType x)
double now()
Return the current time in seconds, relative to an arbitrary starting point.
bool isSystemClock()
Check if YARP is providing system time.
std::string gethostname()
Portable wrapper for the gethostname() function.
The main, catch-all namespace for YARP.