Files
Basalt2/docs/references/log.md
2025-03-18 00:52:20 +00:00

77 lines
1.6 KiB
Markdown

# Log
Logger module for Basalt. Logs messages to the console and optionally to a file.
## Fields
|Field|Type|Description|
|---|---|---|
|_logs|`table`|The complete log history|
|_enabled|`boolean`|If the logger is enabled|
|_logToFile|`boolean`|If the logger should log to a file|
|_logFile|`string`|The file to log to|
|LEVEL|`table`|The log levels|
## Functions
|Method|Returns|Description|
|---|---|---|
|[Log.debug](#log-debug)|-|Sends a debug message
|[Log.error](#log-error)|-|Sends an error message
|[Log.info](#log-info)|-|Sends an info message
|[Log.setEnabled](#log-setenabled)|-|Sets if the logger should log
|[Log.setLogToFile](#log-setlogtofile)|-|Sets if the logger should log to a file
|[Log.warn](#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.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.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.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")
```