mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
use separate <wallet>_debug.log with -wallet option
This commit is contained in:
parent
fd6c104110
commit
bdbbcaf3d1
@ -683,7 +683,8 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
|
||||
//ignore masternodes below protocol version
|
||||
nMasternodeMinProtocol = GetArg("-masternodeminprotocol", 0);
|
||||
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
|
||||
//define wallet and debug file
|
||||
strWalletFile = GetArg("-wallet", "wallet.dat");
|
||||
|
||||
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
||||
|
||||
@ -701,6 +702,9 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
if (!lock.try_lock())
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. DarkCoin is probably already running."), strDataDir.c_str()));
|
||||
|
||||
if(strWalletFile != "wallet.dat")
|
||||
strDebugFile = boost::filesystem::basename(strWalletFile) + "_debug.log";
|
||||
|
||||
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
||||
ShrinkDebugFile();
|
||||
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
||||
|
@ -73,6 +73,8 @@ map<string, vector<string> > mapMultiArgs;
|
||||
bool fMasterNode = false;
|
||||
string strMasterNodePrivKey = "";
|
||||
string strMasterNodeAddr = "";
|
||||
string strWalletFile = "wallet.dat";
|
||||
string strDebugFile = "debug.log";
|
||||
int nInstantXDepth = 1;
|
||||
int nDarksendRounds = 2;
|
||||
int nAnonymizeDarkcoinAmount = 1000;
|
||||
@ -250,7 +252,7 @@ static void DebugPrintInit()
|
||||
assert(fileout == NULL);
|
||||
assert(mutexDebugLog == NULL);
|
||||
|
||||
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
|
||||
boost::filesystem::path pathDebug = GetDataDir() / strDebugFile;
|
||||
fileout = fopen(pathDebug.string().c_str(), "a");
|
||||
if (fileout) setbuf(fileout, NULL); // unbuffered
|
||||
|
||||
@ -287,7 +289,7 @@ int LogPrint(const char* category, const char* pszFormat, ...)
|
||||
// reopen the log file, if requested
|
||||
if (fReopenDebugLog) {
|
||||
fReopenDebugLog = false;
|
||||
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
|
||||
boost::filesystem::path pathDebug = GetDataDir() / strDebugFile;
|
||||
if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
|
||||
setbuf(fileout, NULL); // unbuffered
|
||||
}
|
||||
@ -1287,7 +1289,7 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
|
||||
void ShrinkDebugFile()
|
||||
{
|
||||
// Scroll debug.log if it's getting too big
|
||||
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
|
||||
boost::filesystem::path pathLog = GetDataDir() / strDebugFile;
|
||||
FILE* file = fopen(pathLog.string().c_str(), "r");
|
||||
if (file && GetFilesize(file) > 10 * 1000000)
|
||||
{
|
||||
|
@ -137,6 +137,8 @@ extern int nLiquidityProvider;
|
||||
extern bool fEnableDarksend;
|
||||
extern int64 enforceMasternodePaymentsTime;
|
||||
extern std::string strMasterNodeAddr;
|
||||
extern std::string strWalletFile;
|
||||
extern std::string strDebugFile;
|
||||
extern int nMasternodeMinProtocol;
|
||||
extern int keysLoaded;
|
||||
extern bool fSucessfullyLoaded;
|
||||
|
Loading…
Reference in New Issue
Block a user