aboutsummaryrefslogtreecommitdiff
path: root/src/ARCodeFile.cpp
diff options
context:
space:
mode:
authorJesse Talavera-Greenberg <jesse@jesse.tg>2023-03-23 13:04:38 -0400
committerGitHub <noreply@github.com>2023-03-23 18:04:38 +0100
commit79dfb8dc8f356834f0b6cf7baf73f77552b08923 (patch)
tree9a2a139617b8e178edd153ac68d56f2d0e48e3ed /src/ARCodeFile.cpp
parent19280cff2d3d618f032d0e6ef4b1d4414fa02f58 (diff)
Introduce `Platform::Log` (#1640)
* Add Platform::Log and Platform::LogLevel * Replace most printf calls with Platform::Log calls * Move a brace down * Move some log entries to one Log call - Some implementations of Log may assume a full line * Log the MAC address as LogLevel::Info
Diffstat (limited to 'src/ARCodeFile.cpp')
-rw-r--r--src/ARCodeFile.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ARCodeFile.cpp b/src/ARCodeFile.cpp
index a95ebbd..53a2386 100644
--- a/src/ARCodeFile.cpp
+++ b/src/ARCodeFile.cpp
@@ -21,6 +21,8 @@
#include "ARCodeFile.h"
#include "Platform.h"
+using Platform::Log;
+using Platform::LogLevel;
// TODO: import codes from other sources (usrcheat.dat, ...)
// TODO: more user-friendly error reporting
@@ -79,7 +81,7 @@ bool ARCodeFile::Load()
if (ret < 1)
{
- printf("AR: malformed CAT line: %s\n", start);
+ Log(LogLevel::Error, "AR: malformed CAT line: %s\n", start);
fclose(f);
return false;
}
@@ -102,14 +104,14 @@ bool ARCodeFile::Load()
if (ret < 2)
{
- printf("AR: malformed CODE line: %s\n", start);
+ Log(LogLevel::Error, "AR: malformed CODE line: %s\n", start);
fclose(f);
return false;
}
if (!isincat)
{
- printf("AR: encountered CODE line with no category started\n");
+ Log(LogLevel::Error, "AR: encountered CODE line with no category started\n");
fclose(f);
return false;
}
@@ -128,21 +130,21 @@ bool ARCodeFile::Load()
if (ret < 2)
{
- printf("AR: malformed data line: %s\n", start);
+ Log(LogLevel::Error, "AR: malformed data line: %s\n", start);
fclose(f);
return false;
}
if (!isincode)
{
- printf("AR: encountered data line with no code started\n");
+ Log(LogLevel::Error, "AR: encountered data line with no code started\n");
fclose(f);
return false;
}
if (curcode.CodeLen >= 2*64)
{
- printf("AR: code too long!\n");
+ Log(LogLevel::Error, "AR: code too long!\n");
fclose(f);
return false;
}