Skip to content

Commit

Permalink
Few more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Darryl Masson committed Jun 9, 2021
1 parent c0e6f8a commit 9e33c6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions MongoLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int MongoLog::RotateLogFile() {
std::cout << "Could not rotate logfile!\n";
return -1;
}
fOutfile << FormatTime(&today, ms) << " [INIT]: logfile initialized: commit " << REDAX_BUILD_COMMIT << "\n";
fOutfile << FormatTime(&today, ms) << " INIT | logfile initialized, commit " << REDAX_BUILD_COMMIT << "\n";
fToday = Today(&today);
if (fDeleteAfterDays == 0) return 0;
std::vector<int> days_per_month = {31,28,31,30,31,30,31,31,30,31,30,31};
Expand All @@ -141,11 +141,11 @@ int MongoLog::RotateLogFile() {
last_week.tm_mday += days_per_month[last_week.tm_mon]; // off by one error???
}
auto p = LogFileName(&last_week);
if (std::experimental::filesystem::exists(p)) {
fOutfile << FormatTime(&today, ms) << " [INIT]: Deleting " << p << '\n';
std::experimental::filesystem::remove(p);
if (fs::exists(p)) {
fOutfile << FormatTime(&today, ms) << " INIT | Deleting " << p << '\n';
fs::remove(p);
} else {
fOutfile << FormatTime(&today, ms) << " [INIT]: No older logfile to delete :(\n";
fOutfile << FormatTime(&today, ms) << " INIT | No older logfile to delete :(\n";
}
return 0;
}
Expand All @@ -160,7 +160,7 @@ int MongoLog::Entry(int priority, const std::string& message, ...){
size_t len = std::vsnprintf(NULL, 0, message.c_str(), args);
va_end (args);
// Declare with proper length
int length_overhead = 46;
int length_overhead = 50;
std::string full_message(length_overhead + len + 1, '\0');
// Fill the new string we just made
FormatTime(&today, ms, full_message.data());
Expand Down
3 changes: 1 addition & 2 deletions V1724.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ int V1724::Read(std::unique_ptr<data_packet>& outptr){
int blt_words=0, nb=0, ret=-5;
std::vector<std::pair<char32_t*, int>> xfer_buffers;
xfer_buffers.reserve(4);
//int blt_size[] = {16, 19, 20, 23};

unsigned count = 0;
int alloc_bytes, request_bytes;
Expand Down Expand Up @@ -249,7 +248,7 @@ int V1724::Read(std::unique_ptr<data_packet>& outptr){
return -1;
}
if (nb > request_bytes) fLog->Entry(MongoLog::Message,
"Board %i got %x more bytes than asked for (headroom %x)",
"Board %i got %x more bytes than asked for (headroom %i)",
fBID, nb-request_bytes, alloc_bytes-nb);

count++;
Expand Down

0 comments on commit 9e33c6d

Please sign in to comment.