Updated the logging system

This commit is contained in:
WolverinDEV
2019-11-23 21:16:55 +01:00
parent b7d60361c0
commit fb5dc72970
28 changed files with 135 additions and 104 deletions
@@ -42,7 +42,7 @@ namespace interaction {
DefaultMemoryInfo* info = nullptr;
if(shmInfo.shm_nattch == 0){ //Im the first program!
debugMessage("Created new memory struct");
debugMessage(LOG_GENERAL, "Created new memory struct");
*(DefaultMemoryInfo*) SHARED_MEMORY_PTR = DefaultMemoryInfo{};
info = (DefaultMemoryInfo*) SHARED_MEMORY_PTR;
@@ -81,7 +81,7 @@ namespace interaction {
auto instanceInfo = ownInfo();
instanceInfo->pid = ::getpid();
pthread_mutex_unlock(&info->memoryLock);
debugMessage("Got application instance id " + to_string(INSTANCE_ID));
debugMessage(LOG_GENERAL, "Got application instance id {}", INSTANCE_ID);
return true;
}
@@ -95,13 +95,13 @@ namespace interaction {
shmid_ds info{};
memset(&info, 0, sizeof(info));
if(shmctl(SHARED_MEMORY_ID, IPC_STAT, &info) < 0){
logMessage(lstream << "Could not collect info: " << strerror(errno));
logMessage(LOG_INSTANCE, "Could not collect info: {}", errno);
return;
}
if(info.shm_nattch == 0){
shmctl(SHARED_MEMORY_ID, IPC_RMID, nullptr);
logMessage("Deleting shared memory");
logMessage(LOG_INSTANCE, "Deleting shared memory");
}
}