removed dead code and cleanup

This commit is contained in:
sehraf 2016-06-18 13:08:14 +02:00
parent 09afbbed5d
commit d8235c6caf
2 changed files with 9 additions and 71 deletions

View File

@ -37,7 +37,6 @@ const int RS_DEBUG_LOGCRASH = 3; /* minimal logfile stored after crashes */
const int RS_DEBUG_LOGC_MAX = 100000; /* max length of crashfile log */ const int RS_DEBUG_LOGC_MAX = 100000; /* max length of crashfile log */
const int RS_DEBUG_LOGC_MIN_SAVE = 100; /* min length of crashfile log */ const int RS_DEBUG_LOGC_MIN_SAVE = 100; /* min length of crashfile log */
//static std::map<int, int> zoneLevel;
static RsLog::logLvl defaultLevel = RsLog::Warning; static RsLog::logLvl defaultLevel = RsLog::Warning;
static FILE *ofd = stderr; static FILE *ofd = stderr;
@ -110,33 +109,6 @@ int setDebugCrashMode(const char *cfile)
return 1; return 1;
} }
#ifdef deadcode // this code is not used by RS
/* this is called when we exit normally */
int clearDebugCrashLog()
{
RsStackMutex stack(logMtx); /******** LOCKED ****************/
/* check we are in crashLog Mode */
if (debugMode != RS_DEBUG_LOGCRASH)
{
fprintf(stderr, "Not in CrashLog Mode - nothing to clear!\n");
return 1;
}
fprintf(stderr, "clearDebugCrashLog() Cleaning up\n");
/* shutdown crashLog Mode */
fclose(ofd);
ofd = stderr;
debugMode = RS_DEBUG_STDERR;
/* just open the file, and then close */
FILE *tmpin = RsDirUtil::rs_fopen(crashfile.c_str(), "w");
fclose(tmpin);
return 1;
}
#endif
int setDebugFile(const char *fname) int setDebugFile(const char *fname)
{ {
RsStackMutex stack(logMtx); /******** LOCKED ****************/ RsStackMutex stack(logMtx); /******** LOCKED ****************/
@ -166,34 +138,6 @@ int setOutputLevel(RsLog::logLvl lvl)
return defaultLevel = lvl; return defaultLevel = lvl;
} }
//#ifdef deadcode // this code is not used by RS
//int setZoneLevel(int lvl, int zone)
//{
// RsStackMutex stack(logMtx); /******** LOCKED ****************/
// zoneLevel[zone] = lvl;
// return zone;
//}
//#endif
//int getZoneLevel(int zone)
//{
// RsStackMutex stack(logMtx); /******** LOCKED ****************/
// return locked_getZoneLevel(zone);
//}
//int locked_getZoneLevel(int /*zone*/)
//{
//#ifdef deadcode // this code is not used by RS
// std::map<int, int>::iterator it = zoneLevel.find(zone);
// if (it == zoneLevel.end())
// {
// return defaultLevel;
// }
// return it -> second;
//#endif
// return defaultLevel;
//}
void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg) void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg)
{ {
// skipp when log level is set to 'None' // skipp when log level is set to 'None'

View File

@ -48,35 +48,29 @@ namespace RsLog {
struct logInfo { struct logInfo {
// module specific log lvl // module specific log lvl
logLvl lvl; logLvl lvl;
// module name // module name (displayed in log)
const std::string name; const std::string name;
}; };
} }
// current RS code uses these (deprecated) defines
#define RSL_NONE RsLog::None
#define RSL_ALERT RsLog::Alert
#define RSL_ERROR RsLog::Error
#define RSL_WARNING RsLog::Warning
#define RSL_DEBUG_ALERT RsLog::Debug_Alert
#define RSL_DEBUG_BASIC RsLog::Debug_Basic
#define RSL_DEBUG_ALL RsLog::Debug_Basic
int setDebugCrashMode(const char *cfile); int setDebugCrashMode(const char *cfile);
//int clearDebugCrashLog();
int setDebugFile(const char *fname); int setDebugFile(const char *fname);
int setOutputLevel(RsLog::logLvl lvl); int setOutputLevel(RsLog::logLvl lvl);
//int setZoneLevel(int lvl, int zone);
//int getZoneLevel(int zone);
void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg); void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg);
/* /*
* retaining old #DEFINES and functions for backward compatibility. * retaining old #DEFINES and functions for backward compatibility.
*/ */
#define RSL_NONE RsLog::None
#define RSL_ALERT RsLog::Alert
#define RSL_ERROR RsLog::Error
#define RSL_WARNING RsLog::Warning
#define RSL_DEBUG_ALERT RsLog::Debug_Alert
#define RSL_DEBUG_BASIC RsLog::Debug_Basic
#define RSL_DEBUG_ALL RsLog::Debug_Basic
//int pqioutput(unsigned int lvl, int zone, std::string msg); //int pqioutput(unsigned int lvl, int zone, std::string msg);
#define pqioutput rslog #define pqioutput rslog