| Summary: | Ktorrent needs an option to control the log file size | ||
|---|---|---|---|
| Product: | [Applications] ktorrent | Reporter: | Donatas Glodenis <dg> |
| Component: | general | Assignee: | Joris Guisson <joris.guisson> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed In: | ||
| Sentry Crash Report: | |||
|
Description
Donatas Glodenis
2007-03-04 11:04:14 UTC
We will add an automatic log rotate after 10 MB, don't see much need in actually having this configurable. SVN commit 666273 by guisson:
Auto rotate log when it gets larger then 10 MB
BUG: 142496
M +17 -2 log.cpp
--- trunk/extragear/network/ktorrent/libktorrent/util/log.cpp #666272:666273
@@ -38,6 +38,8 @@
namespace bt
{
+ const Uint32 MAX_LOG_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
+
class Log::Private
{
public:
@@ -103,8 +105,8 @@
{
tmp += line;
}
-
- void endline()
+
+ void finishLine()
{
*out << QDateTime::currentDateTime().toString() << ": " << tmp << ::endl;
fptr.flush();
@@ -123,6 +125,19 @@
}
tmp = "";
}
+
+ void endline()
+ {
+ finishLine();
+ if (fptr.size() > MAX_LOG_FILE_SIZE)
+ {
+ // calling setOutputFile will rotate the logs
+ tmp = "Log larger then 10 MB, rotating";
+ finishLine();
+ QString file = fptr.name();
+ setOutputFile(file);
+ }
+ }
};
Log::Log()
|