Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » append in logging not working
append in logging not working [message #41023] Mon, 21 October 2013 19:40
wimpie is currently offline  wimpie
Messages: 46
Registered: March 2013
Location: holland
Member
Hello,

For some time I had the problem that LOG_APPEND would actually not work. I saw you guys noticed it also... here...
I think it can be solved as follows (in Core/Log.cpp):
void LogOut::Create(bool append)
{
	Close();
	
	if (!append) { // <- when appending, none of the following is needed
		char next[512];
		for(int rot = options >> 24; rot >= 0; rot--) {
			char current[512];
			if(rot == 0)
				strcpy(current, filepath);
			else
				sprintf(current, rot > 1 && (options & LOG_ROTATE_GZIP) ? "%s.%d.gzip" : "%s.%d",
				        filepath, rot);
			if(FileExists(current)) {
				if(rot == (options >> 24))
					FileDelete(current);
				else
				if((options & LOG_ROTATE_GZIP) && rot == 1 && !IsPanicMode())
					SaveFile(next, GZCompress(LoadFile(current)));
				else
					FileMove(current, next);
			}
			strcpy(next, current);
		}
	}


cheers
Previous Topic: CParser small bug in ReadInt64(int64 min, int64 max)
Next Topic: CParser: Suggest check for overflow in ReadInt, ReadDouble...
Goto Forum:
  


Current Time: Thu Mar 28 19:21:32 CET 2024

Total time taken to generate the page: 0.00989 seconds