Steamodded implements 6 levels of logging, each with a different purpose. The levels are as follows:
TRACE
: Very detailed information, typically of interest only when diagnosing problems.DEBUG
: Detailed information, typically of interest only when diagnosing problems.INFO
: Confirmation that things are working as expected.WARN
: An indication that something unexpected happened, or indicative of some problem in the near future. The software is still working as expected.ERROR
: Due to a more serious problem, the software has not been able to perform some function.FATAL
: A serious error, indicating that the program itself may be unable to continue running.
There a few different methods of viewing logs, with their own pros and cons. Below is a list of them, sorted by ease of use:
- Lovely Console (or the terminal on MacOS)
- Lovely prints all logs received to the console while the game is running. This is the simplest method to view the logs as it's already running in normal SMODS installs.
- Lovely log files
- Lovely writes the contents of the logs to log files in the
Mods/lovely/log
folder in your Balatro config folder. This is useful for sharing logs with others and checking logs after the game has been closed.
- Lovely writes the contents of the logs to log files in the
- DebugPlus
- DebugPlus is a mod to help with debugging. One of the features it implements is an in game console. Logged messages will show up for a few seconds when logged in game, and you can open the console with
/
to view all logs. - By default DebugPlus hides Debug and Trace logs. To view these logs, you will need to switch the log level in it's config to DEBUG (Mods > DebugPlus > Console)
- DebugPlus is a mod to help with debugging. One of the features it implements is an in game console. Logged messages will show up for a few seconds when logged in game, and you can open the console with
- SMODS Debug Console
- SMODS includes a console window that can be used with it. If you have python installed you can run it on tk_debug_window.py. This console has some more advanced features such as searching/filtering the logs.
- To get logs, you need to launch the console before launching the game.
- This method does not work when using
print
to log, unlike the other methods listed.
All logging functions follow the same pattern, with the first argument being the message, and the second argument being
the logger name. This argument order is consistent across all logging functions. The logger name is optional and will
default to DefaultLogger
but it is strongly recommended that you use it for clarity purposes.
sendTraceMessage("This is a trace message", "MyTraceLogger")
2024-04-04 22:58:45 :: TRACE :: MyTraceLogger :: This is a trace message
sendDebugMessage("This is a debug message", "MyDebugLogger")
2024-04-04 22:58:45 :: TRACE :: MyDebugLogger :: This is a debug message
sendInfoMessage("This is an info message", "MyInfoLogger")
2024-04-04 22:58:45 :: INFO :: MyInfoLogger :: This is an info message
sendWarnMessage("This is a warn message", "MyWarnLogger")
2024-04-04 22:58:45 :: WARN :: MyWarnLogger :: This is a warn message
sendErrorMessage("This is an error message", "MyErrorLogger")
2024-04-04 22:58:45 :: ERROR :: MyErrorLogger :: This is an error message
sendFatalMessage("This is a fatal message", "MyFatalLogger")
2024-04-04 22:58:45 :: FATAL :: MyFatalLogger :: This is a fatal message
A logger name can be any string, but it is recommended to use a descriptive name to make it easier to identify where the log message is coming from.
An additional function sendMessageToConsole
is available to send a log message with a custom log level. This function
is not recommended for general use.
You can, with this function, implements your own log levels, but it is not recommended to do so, as the debug console do not support custom log levels by default. You will have to modify the debug console by yourself to support custom log levels. If you want to do so, you'll find the function signature in the debug.lua file, and the log supported in the console on the tk_debug_window.py file.
Keep in mind that other people may not have the same modifications as you, so it is recommended to use the default log levels.
The debug console is a tool that allows you to see the logs in real-time, filter them, and search for specific strings within the logs. It is a very useful tool for debugging and diagnosing problems.
The debug console requires python 3.6+ to be installed on your system. To open the debug console,
execute tk_debug_window.py
in the steamodded repo.
The debug console was not tested with python 3.6, but it should work with it. It is recommended to use the latest python release.
You need to have the debug console open before you start the game. The console will show all logs in real-time.
-s
or--scale
to control the font scale of console.
- You can filter logs by logger name.
- You can filter logs by log level (only a single level, or the level selected and above).
- You can search for a specific string within the logs shown.
- You can save the logs to a file using the top left dropdown.
- You can clear the logs all the logs received from the console.
Ctrl + F
: Focus the search bar.Enter
when focused on the search bar: Go to the next search result.Esc
when focused on the search bar or the logger filter: Focus back into the logs.Shift + Enter
when focused on the search bar: Go to the previous search result.Ctrl + S
: Save all logs to a file.Ctrl + Shift + S
: Save filtered logs to a file.Ctrl + D
: Clear all logs.Ctrl + L
: Focus the logger filter.
Please open an issue on the GitHub repository if you encounter any problems with the debug console.