Skip to content

Message logging

Gombaris edited this page May 31, 2024 · 1 revision

Javascript

Info - Normally, messages are written as info (white text).

$log("Current speed:" + speed_val);

Warning - By adding "warning:", the message is written as warning (yellow text).

$log("Warning: You exceeded the speed limit " + speed_limit + " km/h");

Error- By adding "error:", the message is written as error (red text).

$log("Error: Unknown source ID");

Lua

Log string or number - to log string or number value, you can directly use the variable in "log" function

log("Variable value: " .. variable)

Log bool type - to log bool type value, you have to convert the value to string

log("Bool value: " .. tostring(my_bool))

Cpp

Info - use "coidlog_info" to log white message

coidlog_info("Current speed:", speed_val);

Warning - use "coidlog_warning" to log yellow message

coidlog_warning("Warning: You exceeded the speed limit ", speed_limit);

Error - use "coidlog_error" to log red message

coidlog_error("Error: Unknown source ID");