Skip to content

Log

Logger module for Basalt. Logs messages to the console and optionally to a file.

Fields

FieldTypeDescription
_logstableThe complete log history
_enabledbooleanIf the logger is enabled
_logToFilebooleanIf the logger should log to a file
_logFilestringThe file to log to
LEVELtableThe log levels

Functions

MethodReturnsDescription
Log.debug-Sends a debug message
Log.error-Sends an error message
Log.info-Sends an info message
Log.setEnabled-Sets if the logger should log
Log.setLogToFile-Sets if the logger should log to a file
Log.warn-Sends a warning message

Log.debug(...)

Sends a debug message to the logger.

Parameters

  • ... (vararg) string The message to log

Usage

lua
Log.debug("This is a debug message")
Log.debug("This is a debug message")

Log.error(...)

Sends an error message to the logger.

Parameters

  • ... (vararg) string The message to log

Usage

lua
Log.error("This is an error message")
Log.error("This is an error message")

Log.info(...)

Sends an info message to the logger.

Parameters

  • ... (vararg) string The message to log

Usage

lua
Log.info("This is an info message")
Log.info("This is an info message")

Log.setEnabled()

Sets if the logger should log

Log.setLogToFile()

Sets if the logger should log to a file.

Log.warn(...)

Sends a warning message to the logger.

Parameters

  • ... (vararg) string The message to log

Usage

lua
Log.warn("This is a warning message")
Log.warn("This is a warning message")

Released under the MIT License.