Add app logs to log file

Refactor a new functions by adding name spaces
Startup times are now logged
This commit is contained in:
Brahim Hadriche committed 2024-01-09 14:19:54 -05:00
1 parent 29969db3e4
commit 73b6314ec7
9 files changed
+128 -85

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
namespace Logger
' Put the file at the root directry to avoid needing to create a folder
const LOGS_FILE_PATH = "cachefs:/playlet_startup_logs.txt"
function Init()
DeleteFile(LOGS_FILE_PATH)
end function
function Log(msg as string)
msg = "[APP] " + msg
' bs:disable-next-line LINT3012
print(msg)
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(msg + `\n`)
buffer.AppendFile(LOGS_FILE_PATH)
end function
end namespace