On Windows there is OutputDebugString function, how do I do the same on Linux?
Update: stderr and stdlog is not what I want. Those are redirected to stdout.
P. S. And syslog is no different.
On Windows there is OutputDebugString function, how do I do the same on Linux?
Update: stderr and stdlog is not what I want. Those are redirected to stdout.
P. S. And syslog is no different.
I'm not sure what OutputDebugString does exactly, but standard C++ defines the standard error stream std::cerr and the standard logging stream std::clog. Both are declared in the header <iostream>.
These are by default tied to the same file descriptor in Linux; the difference is that cerr is unbuffered, while clog is buffered (I believe it's line-buffered).
There is no notion of a "system debugger" in Linux. If you want to write to the system log, you can use syslog(3).
syslog(3)? I see such a notation often, but can't understand the meaning.syslog is in section 3 of the Linux manual. man 3 syslog will bring up the manpage for it.There is probably no exact equivalent of such a function in Linux or Posix systems.
You could output to stderr (if in C or C++), or to std::cerr or std::clog in C++.
Notice that with most shells, you can start some program and redirect differently and independently their stdout & their stderr.
For system logging, you could use the openlog & syslog functions.
If you want to output to the controlling terminal (if it exists), you could use the /dev/tty device.