fix pb with special log file names

This commit is contained in:
dockes 2006-11-08 15:34:20 +00:00
parent 4ebed2e817
commit df7b8711a1
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.7 2006-11-08 07:22:14 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.8 2006-11-08 15:34:20 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -68,8 +68,9 @@ RclConfig *recollinit(RclInitFlags flags,
// Initialize logging
if (!logfilename.empty()) {
logfilename = path_tildexpand(logfilename);
// If not an absolute path, compute relative to config dir
if (logfilename.at(0) != '/') {
// If not an absolute path or , compute relative to config dir
if (logfilename.at(0) != '/' &&
!DebugLog::DebugLog::isspecialname(logfilename.c_str())) {
logfilename = path_cat(config->getConfDir(), logfilename);
}
DebugLog::setfilename(logfilename.c_str());

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid [] = "@(#$Id: debuglog.cpp,v 1.3 2006-01-23 13:32:28 dockes Exp $ (C) 2002 OKYZ";
static char rcsid [] = "@(#$Id: debuglog.cpp,v 1.4 2006-11-08 15:34:20 dockes Exp $ (C) 2002 OKYZ";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -43,6 +43,11 @@ namespace DebugLog {
#endif // NO_NAMESPACES
bool DebugLog::isspecialname(const char *logname)
{
return !strcmp(logname, "stdout") || !strcmp(logname, "stderr");
}
class DebugLogWriter {
public:
virtual ~DebugLogWriter() {}

View File

@ -61,6 +61,7 @@ class DebugLog {
virtual void pushlevel(int lev);
virtual void poplevel();
virtual void logdate(int onoff) {dodate = onoff;}
static bool isspecialname(const char *logname);
};
extern DebugLog *getdbl();