Server

log

Logs a message to the console and/or Discord webhook.

fjsf.log(type, message, opts?, ...)

Description

Immediately logs a message using a unified logging system.

Supports formatted string messages, dynamic function-based messages, optional Discord webhook output, and colored console output based on log type.


Parameters

type (string) Log severity type.

Supported values:

  • info

  • warn

  • error

  • debug


message (string | function) Message definition.

  • string β€” Supports indexed placeholders {1}, {2}, etc.

  • function β€” Called with message arguments and must return a string


opts (table | nil) Optional configuration.

  • webhook (string | nil) β€” Overrides default Discord webhook

  • console (boolean) β€” Whether to print to console (default: true)


... (any) Arguments used for placeholder replacement or passed to the message function.


Returns

Nothing.


Example


logger

Registers an automatic logger bound to a server event.

Description

Registers a server event listener that automatically logs whenever the event is triggered.

All event arguments are forwarded to the log message builder.


Parameters

event (string) Server event name.


type (string) Log severity type.

Supported values:

  • info

  • warn

  • error

  • debug


message (string | function) Message definition used when the event is triggered.

Behaves the same as the message parameter in fjsf.log.


opts (table | nil) Optional configuration.

Same options as fjsf.log.


Returns

Nothing.


Example

Last updated