log environment versions when debug logs are enabled

This commit is contained in:
Mikayla Fischler 2024-03-23 00:49:19 -04:00
parent 19869416af
commit 968b0a9122
6 changed files with 26 additions and 12 deletions

View File

@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder")
local apisessions = require("coordinator.session.apisessions")
local COORDINATOR_VERSION = "v1.3.0"
local COORDINATOR_VERSION = "v1.3.1"
local CHUNK_LOAD_DELAY_S = 30.0
@ -103,6 +103,7 @@ log.info("========================================")
println(">> SCADA Coordinator " .. COORDINATOR_VERSION .. " <<")
crash.set_env("coordinator", COORDINATOR_VERSION)
crash.dbg_log_env()
----------------------------------------
-- main application

View File

@ -18,7 +18,7 @@ local iocontrol = require("pocket.iocontrol")
local pocket = require("pocket.pocket")
local renderer = require("pocket.renderer")
local POCKET_VERSION = "v0.7.2-alpha"
local POCKET_VERSION = "v0.7.3-alpha"
local println = util.println
local println_ts = util.println_ts
@ -54,6 +54,7 @@ log.info("BOOTING pocket.startup " .. POCKET_VERSION)
log.info("========================================")
crash.set_env("pocket", POCKET_VERSION)
crash.dbg_log_env()
----------------------------------------
-- main application

View File

@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
local renderer = require("reactor-plc.renderer")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v1.7.1"
local R_PLC_VERSION = "v1.7.2"
local println = util.println
local println_ts = util.println_ts
@ -55,6 +55,7 @@ log.info("========================================")
println(">> Reactor PLC " .. R_PLC_VERSION .. " <<")
crash.set_env("reactor-plc", R_PLC_VERSION)
crash.dbg_log_env()
----------------------------------------
-- main application

View File

@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
local sps_rtu = require("rtu.dev.sps_rtu")
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
local RTU_VERSION = "v1.9.0"
local RTU_VERSION = "v1.9.1"
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
@ -71,6 +71,7 @@ log.info("========================================")
println(">> RTU GATEWAY " .. RTU_VERSION .. " <<")
crash.set_env("rtu", RTU_VERSION)
crash.dbg_log_env()
----------------------------------------
-- main application

View File

@ -24,6 +24,21 @@ function crash.set_env(application, version)
ver = version
end
-- log environment versions
---@param log_msg function log function to use
local function log_versions(log_msg)
log_msg(util.c("RUNTIME: ", _HOST))
log_msg(util.c("LUA VERSION: ", _VERSION))
log_msg(util.c("APPLICATION: ", app))
log_msg(util.c("FIRMWARE VERSION: ", ver))
log_msg(util.c("COMMS VERSION: ", comms.version))
if has_graphics then log_msg(util.c("GRAPHICS VERSION: ", core.version)) end
if has_lockbox then log_msg(util.c("LOCKBOX VERSION: ", lockbox.version)) end
end
-- when running with debug logs, log the useful information that the crash handler knows
function crash.dbg_log_env() log_versions(log.debug) end
-- handle a crash error
---@param error string error message
function crash.handler(error)
@ -31,13 +46,7 @@ function crash.handler(error)
log.info("=====> FATAL SOFTWARE FAULT <=====")
log.fatal(error)
log.info("----------------------------------")
log.info(util.c("RUNTIME: ", _HOST))
log.info(util.c("LUA VERSION: ", _VERSION))
log.info(util.c("APPLICATION: ", app))
log.info(util.c("FIRMWARE VERSION: ", ver))
log.info(util.c("COMMS VERSION: ", comms.version))
if has_graphics then log.info(util.c("GRAPHICS VERSION: ", core.version)) end
if has_lockbox then log.info(util.c("LOCKBOX VERSION: ", lockbox.version)) end
log_versions(log.info)
log.info("----------------------------------")
log.info(debug.traceback("--- begin debug trace ---", 1))
log.info("--- end debug trace ---")

View File

@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.3.0"
local SUPERVISOR_VERSION = "v1.3.1"
local println = util.println
local println_ts = util.println_ts
@ -86,6 +86,7 @@ log.info("========================================")
println(">> SCADA Supervisor " .. SUPERVISOR_VERSION .. " <<")
crash.set_env("supervisor", SUPERVISOR_VERSION)
crash.dbg_log_env()
----------------------------------------
-- main application