48 : fpExtStream(nullptr),
64 fName(BuildinStreamName(os, name)),
81 std::ostream* os =
nullptr;
82 if (name ==
"<cout>" || name ==
"-") os = &cout;
83 else if (name ==
"<cerr>") os = &cerr;
84 else if (name ==
"<clog>") os = &clog;
96 string(
"open for '") + name +
"' failed: ",
129 lock_guard<RlogFile>
lock(*
this);
133 ::clock_gettime(CLOCK_REALTIME, &ts);
136 ::localtime_r(&ts.tv_sec, &tymd);
143 <<
RosPrintf(tymd.tm_year+1900,
"d",4) <<
"-"
144 <<
RosPrintf(tymd.tm_mon+1,
"d0",2) <<
"-"
145 <<
RosPrintf(tymd.tm_mday,
"d0",2) <<
" -+- \n";
152 os <<
"-" << tag <<
"- "
156 <<
RosPrintf(
int(ts.tv_nsec)/1000,
"d0",6) <<
" : ";
160 if (str[str.length()-1] !=
'\n') os << endl;
171 os << bl << (text?text:
"--") <<
"RlogFile @ " <<
this << endl;
172 os << bl <<
" fpExtStream: " <<
fpExtStream << endl;
173 os << bl <<
" fIntStream.isopen " <<
fIntStream.is_open() << endl;
175 os << bl <<
" fName " <<
fName << endl;
204 string str = lmsg.
String();
205 if (str.length() > 0)
Write(str, lmsg.
Tag());
224 const std::string& str)
226 if (str.size())
return str;
227 if (os == &cout)
return string(
"<cout>");
228 if (os == &cerr)
return string(
"<cerr>");
229 if (os == &clog)
return string(
"<clog>");
230 return string(
"<?stream?>");
void InitErrno(const std::string &meth, const std::string &text, int errnum)
FIXME_docs.
std::ostream * fpExtStream
pointer to external stream
int fTagYear
year of last time tag
RlogFile & operator<<(const RlogMsg &lmsg)
FIXME_docs.
int fTagMonth
month of last time tag
std::ofstream fIntStream
internal stream
void UseStream(std::ostream *os, const std::string &name="")
FIXME_docs.
int fTagDay
day of last time tag
std::string fName
log file name
bool Open(std::string name, RerrMsg &emsg)
FIXME_docs.
void ClearTime()
FIXME_docs.
bool fNew
true if never opened or used
std::mutex fMutex
mutex to lock file
RlogFile()
Default constructor.
void Dump(std::ostream &os, int ind=0, const char *text=0) const
FIXME_docs.
std::string BuildinStreamName(std::ostream *os, const std::string &str)
FIXME_docs.
void Write(const std::string &str, char tag=0)
FIXME_docs.
char Tag() const
FIXME_docs.
std::string String() const
FIXME_docs.
I/O appicator to generate fill characters.
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Declaration of class ReventLoop.