Shared
Logging

Logging

RP.Log provides coloured console output available on both server and client. Debug output is gated behind Config.Debug.


Functions

RP.Log.info(msg, ...)

General informational message. Printed in white with a blue [RP] prefix.

RP.Log.info("Player loaded:", p.name)

RP.Log.warning(msg, ...)

Non-fatal warning. Printed with a yellow [RP] prefix.

RP.Log.warning("Callback `" .. name .. "` already exists!")

RP.Log.error(msg, ...)

Error message. Printed with a red [RP] prefix.

RP.Log.error("Failed to load vehicle:", vehId)

RP.Log.debug(msg, ...)

Only prints when RP.Debug is true (Config.Debug). Printed with a purple [RP] prefix.

RP.Log.debug("Registered callback", name, "for", invoker)

RP.Log.custom(...)

Prints with the current resource name as prefix, no level colouring.

RP.Log.custom("Race started:", raceName)
-- output: [my-race-resource]  Race started: Sprint 01

Colour reference

FiveM console colour codes used internally:

CodeColour
^1Red
^2Green
^3Yellow
^4Blue
^7White (reset)
^9Purple