ix.log

Logging helper functions.

Predefined flags:

FLAG_NORMAL
FLAG_SUCCESS
FLAG_WARNING
FLAG_DANGER
FLAG_SERVER
FLAG_DEV

Functions

ix.log.Add(client, logType, ...)

View source »

Adds a typed log entry. The entry is visible to admins with log access, printed to the server console, and written through the logging system.

Parameters

  • client Player or nil

    Player tied to the log (can be nil).

  • ...

    Arguments for the formatter.

Example Usage

ix.log.Add(client, "charMoneyGive", giverName, receiverName, amount)

See Also

ix.log.AddRaw(logString, bNoSave)

View source »

Adds a log entry without using a log type. Sends the message to admins with log access, prints it to the server console, and writes it through log handlers unless bNoSave is true.

Parameters

  • logString string

    Pre-formatted log message.

  • bNoSave boolean optional

    If true, skips handler output (e.g. file logging).

Example Usage

ix.log.AddRaw("Server is restarting in 5 minutes.")

See Also

ix.log.AddType(logType, format, flag)

View source »

Registers a log type for ix.log.Add. format is either a format string or a function (client, ...) -> string.

flag is a display/severity tag (see FLAG_*). If omitted, it behaves like a normal log.

Parameters

  • format string or function

    Format string or formatter function.

  • flag number optional

    One of the FLAG_* constants.

Example Usage

ix.log.AddType("charMoneyGive", "%s gave %s %d tokens.", FLAG_SUCCESS)

ix.log.CallHandler(event, ...)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Calls a specific event on all registered log handlers.

Parameters

  • event

  • ...

ix.log.Parse(client, logType, ...)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Turns a log type + args into (message, flag). Missing type falls back to a warning string. No formatter returns -1 (caller bails).

Parameters

  • client Player or nil

    Player tied to the log.

  • logType string

    Log type name.

  • ...

    Arguments for the formatter.

Returns

  • string or number

    Message string, or -1 to skip logging.

  • number

    Flag from the registered type.

ix.log.Send(receivers, logString, flag)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Sends a log entry to clients.

Parameters

  • logString string

    Log message.

  • flag number optional

    FLAG_* value (defaults to normal).