Fixed and closed #542: log appending now correct when flushing old entries.
This commit is contained in:
parent
5f11f2e4ed
commit
4a91270ff1
2 changed files with 8 additions and 6 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.2.539")]
|
[assembly: AssemblyVersion("3.0.2.540")]
|
||||||
[assembly: AssemblyFileVersion("3.0.2.539")]
|
[assembly: AssemblyFileVersion("3.0.2.540")]
|
||||||
|
|
|
@ -489,8 +489,9 @@ namespace ScrewTurn.Wiki {
|
||||||
/// <param name="size">The size to shrink the log to (in bytes).</param>
|
/// <param name="size">The size to shrink the log to (in bytes).</param>
|
||||||
private void CutLog(int size) {
|
private void CutLog(int size) {
|
||||||
lock(this) {
|
lock(this) {
|
||||||
// Contains the log messages from the newest to the oldest
|
// Contains the log messages from oldest to newest, and reverse the list
|
||||||
List<LogEntry> entries = new List<LogEntry>(GetLogEntries());
|
List<LogEntry> entries = new List<LogEntry>(GetLogEntries());
|
||||||
|
entries.Reverse();
|
||||||
|
|
||||||
FileInfo fi = new FileInfo(GetFullPath(LogFile));
|
FileInfo fi = new FileInfo(GetFullPath(LogFile));
|
||||||
int difference = (int)(fi.Length - size);
|
int difference = (int)(fi.Length - size);
|
||||||
|
@ -503,9 +504,7 @@ namespace ScrewTurn.Wiki {
|
||||||
toStore.Add(entries[i]);
|
toStore.Add(entries[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse the temp list because entries contains the log messages
|
toStore.Sort((a, b) => a.DateTime.CompareTo(b.DateTime));
|
||||||
// starting from the newest to the oldest
|
|
||||||
toStore.Reverse();
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
// Type | DateTime | Message | User
|
// Type | DateTime | Message | User
|
||||||
|
@ -556,6 +555,9 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.Sort((a, b) => a.DateTime.CompareTo(b.DateTime));
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue