Convert linux to use new logging facility

This commit is contained in:
Azamat H. Hackimov 2024-08-20 01:38:10 +03:00
parent e627dfc546
commit dc82d2314d
4 changed files with 26 additions and 24 deletions

View File

@ -15,6 +15,7 @@ set(CPPS
add_library(linux STATIC ${HEADERS} ${CPPS})
target_link_libraries(linux PRIVATE
cfile
plog::plog
)
target_include_directories(linux PUBLIC
$<BUILD_INTERFACE:

View File

@ -50,6 +50,7 @@
#include "joystick.h"
#include "inffile.h"
#include "lnxcontroller.h"
#include "log.h"
// Sorry! This is needed for the semi-hacky mouselook support
#include "descent.h"
@ -919,7 +920,7 @@ bool lnxgameController::enum_controllers() {
m_ControlList[num_devs].sensmod[i] = 1.0f;
}
m_ControlList[num_devs].deadzone = JOY_DEADZONE;
mprintf(0, "Controller %s found.\n", jc.name);
LOG_DEBUG.printf("Controller %s found.\n", jc.name);
// okay, now search for a "****.ctl" file in the current directory
parse_ctl_file(num_devs, jc.name);
@ -1103,7 +1104,7 @@ float lnxgameController::get_button_value(int8_t controller, ct_format format, u
break;
default:
mprintf(1, "gameController::button unsupported format for function\n");
LOG_WARNING << "gameController::button unsupported format for function";
}
return val;
@ -1203,7 +1204,7 @@ float lnxgameController::get_axis_value(int8_t controller, uint8_t axis, ct_form
val = val - 1.0f;
} else {
val = 0.0f;
mprintf(1, "gameController::axis unsupported format for function.\n");
LOG_WARNING << "gameController::axis unsupported format for function.";
}
ct_packet key_slide1, key_bank;
@ -1337,7 +1338,7 @@ float lnxgameController::get_pov_value(int8_t controller, ct_format format, uint
break;
default:
mprintf(1, "gameController::pov unsupported format for function\n");
LOG_WARNING << "gameController::pov unsupported format for function";
}
return val;
@ -1365,7 +1366,7 @@ float lnxgameController::get_key_value(int key, ct_format format) {
break;
default:
mprintf(1, "gameController::key unsupported format for function\n");
LOG_WARNING << "gameController::key unsupported format for function";
}
return val;

View File

@ -41,8 +41,8 @@
* $NoKeywords: $
*/
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <sys/types.h>
#if defined(POSIX)
@ -58,7 +58,7 @@
#include "appdatabase.h"
#include "linux/lnxdatabase.h"
#include "pserror.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "registry.h"
@ -103,7 +103,7 @@ oeLnxAppDatabase::~oeLnxAppDatabase() {
return;
}
mprintf(0, "Can't Export Database Since It's Not There!\n");
LOG_ERROR << "Can't Export Database Since It's Not There!";
}
CRegistry *oeLnxAppDatabase::GetSystemRegistry() { return database; }
@ -118,7 +118,7 @@ bool oeLnxAppDatabase::create_record(const char *pathname) {
database->CreateKey((char *)pathname);
return true;
}
mprintf(0, "Can't CreateKey because database NULL\n");
LOG_ERROR << "Can't CreateKey because database NULL";
return false;
}
@ -128,7 +128,7 @@ bool oeLnxAppDatabase::lookup_record(const char *pathname) {
if (database) {
return database->LookupKey((char *)pathname);
}
mprintf(0, "Can't lookup key because database NULL\n");
LOG_ERROR << "Can't lookup key because database NULL";
return false;
}
@ -138,7 +138,7 @@ bool oeLnxAppDatabase::read(const char *label, char *entry, int *entrylen) {
ASSERT(entry);
ASSERT(entrylen);
if (!database) {
mprintf(0, "Can't read record because database NULL\n");
LOG_ERROR << "Can't read record because database NULL";
return false;
}
@ -159,7 +159,7 @@ bool oeLnxAppDatabase::read(const char *label, void *entry, int wordsize) {
ASSERT(label);
ASSERT(entry);
if (!database) {
mprintf(0, "Can't read record because Database NULL\n");
LOG_ERROR << "Can't read record because Database NULL";
return false;
}
@ -182,7 +182,7 @@ bool oeLnxAppDatabase::read(const char *label, void *entry, int wordsize) {
*((uint32_t *)entry) = (uint32_t)data;
break;
default:
mprintf(0, "Unable to read key %s, unsupported size", label);
LOG_ERROR.printf("Unable to read key %s, unsupported size", label);
return false;
break;
}
@ -203,7 +203,7 @@ bool oeLnxAppDatabase::write(const char *label, const char *entry, int entrylen)
ASSERT(label);
ASSERT(entry);
if (!database) {
mprintf(0, "Can't write record because database NULL\n");
LOG_ERROR << "Can't write record because database NULL";
return false;
}
@ -213,7 +213,7 @@ bool oeLnxAppDatabase::write(const char *label, const char *entry, int entrylen)
bool oeLnxAppDatabase::write(const char *label, int entry) {
ASSERT(label);
if (!database) {
mprintf(0, "Can't write record because database NULL\n");
LOG_ERROR << "Can't write record because database NULL";
return false;
}
return database->CreateRecord((char *)label, REGT_DWORD, &entry);

View File

@ -47,13 +47,13 @@
* $NoKeywords: $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// #include "local_malloc.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include "log.h"
#include "registry.h"
#include "mono.h"
#if defined(_WIN32)
#define strcasecmp stricmp
@ -244,10 +244,10 @@ bool CRegistry::Import() {
char *ptr;
file = fopen(name, "rt");
if (!file) {
mprintf(0, "REGISTRY: Unable to import %s\n", name);
LOG_ERROR.printf("REGISTRY: Unable to import %s", name);
return false;
}
mprintf(0, "REGISTRY: Importing %s\n", name);
LOG_INFO.printf("REGISTRY: Importing %s", name);
Destroy();
bool oktocreate;