From 79dfb8dc8f356834f0b6cf7baf73f77552b08923 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Thu, 23 Mar 2023 13:04:38 -0400 Subject: 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 --- src/ARCodeFile.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/ARCodeFile.cpp') 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; } -- cgit v1.2.3