Function logf()
Jump to navigation
Jump to search
Insert a formated record into the socket's event log. Suitable for debugging purposes.
nil logf(message)
Parameters
string message will be inserted into the event log. Can use tokens described below. The tokens will be replaced by following parameters (variable arguments).
Tokens
%dis substituted by following argument as a number%sis substituted by following argument as a number
There is no %b token to display boolean values. To display boolean x as a number, use 'x and 1 or 0' idiom (true as 1, false as 0).
Return value
nil
Usage
local a = 42
local b = false
local c = "Hello";
-- displays 'test: 42, 0, Hello.'
log("test: %d, %d, %s.", a, b and 1 or 0, c)
See also
- log() to display unformatted string and system properties