6 #ifndef YARP_OS_LOGSTREAM_H
7 #define YARP_OS_LOGSTREAM_H
50 std::ostringstream oss;
69 const double externaltime,
72 stream(new Stream(type, file, line, func, externaltime, pred, comp))
85 if (!stream->pred || stream->pred()) {
86 std::string s = stream->oss.str();
91 if (s.back() ==
' ') {
94 yarp::os::Log(stream->file, stream->line, stream->func,
nullptr, yarp::os::Log::logInternalComponent()).
warning(
95 "' ' was expected. Some `operator<<` does not add an extra space at the end");
98 if (s.back() ==
'\n') {
99 yarp::os::Log(stream->file, stream->line, stream->func,
nullptr, yarp::os::Log::logInternalComponent()).
warning(
100 "Removing extra \\n (stream-style)");
104 Log::do_log(stream->type,
111 stream->externaltime,
126 stream->oss << (
t ?
"true" :
"false");
127 if (!stream->nospace) {
135 if (!stream->nospace) {
143 if (!stream->nospace) {
151 if (!stream->nospace) {
159 if (!stream->nospace) {
167 if (!stream->nospace) {
175 if (!stream->nospace) {
183 if (!stream->nospace) {
191 if (!stream->nospace) {
199 if (!stream->nospace) {
207 if (!stream->nospace) {
215 if (!stream->nospace) {
223 if (!stream->nospace) {
231 if (!stream->nospace) {
239 stream->oss <<
t.c_str();
240 if (!stream->nospace) {
246 template <
typename T>
249 bool nospace = stream->nospace;
250 stream->nospace =
true;
252 for (
typename std::vector<T>::const_iterator it =
t.begin(); it !=
t.end(); ++it) {
254 if (it !=
t.begin()) {
260 stream->nospace = nospace;
261 if (!stream->nospace) {
void yarp_print_trace(FILE *out, const char *file, unsigned int line)
Low level function for printing a stack trace, if implemented (ACE or gcc/Linux).
LogStream & operator<<(unsigned short t)
LogStream & operator<<(const void *t)
LogStream & operator<<(unsigned int t)
LogStream & operator<<(const std::vector< T > &t)
LogStream & operator<<(char t)
LogStream & operator<<(bool t)
LogStream & operator<<(unsigned long long t)
LogStream(Log::LogType type, const char *file, unsigned int line, const char *func, const double externaltime, const yarp::os::Log::Predicate pred=nullptr, const LogComponent &comp=Log::defaultLogComponent())
LogStream & operator<<(double t)
LogStream & operator<<(unsigned long t)
LogStream & operator<<(float t)
LogStream & operator<<(const std::string &t)
LogStream & operator<<(signed long long t)
LogStream & operator<<(const char *t)
LogStream & operator<<(signed int t)
LogStream(const LogStream &o)
LogStream & operator<<(signed short t)
LogStream & operator<<(signed long t)
void warning(const char *msg,...) const
static double nowSystem()
bool isClockInitialized()
Check if YARP clock is initialized.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
bool isSystemClock()
Check if YARP is providing system time.
The main, catch-all namespace for YARP.