2026-01-03 09:07:50 +01:00
|
|
|
# SimpleLogger
|
2025-12-21 18:44:38 +01:00
|
|
|
|
2026-01-03 09:07:50 +01:00
|
|
|
Multi-level logging system for Godot with timestamps and file persistence.
|
2025-12-21 18:44:38 +01:00
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
2026-01-03 09:07:50 +01:00
|
|
|
- 5 log levels: TRACE, DEBUG, INFO, WARN, ERROR
|
|
|
|
|
- Full and abbreviated function names
|
|
|
|
|
- Optional timestamps
|
|
|
|
|
- File logging with auto-directory creation
|
|
|
|
|
- Configurable argument separator
|
2025-12-21 18:44:38 +01:00
|
|
|
|
2026-01-03 09:07:50 +01:00
|
|
|
## Properties
|
2025-12-21 18:44:38 +01:00
|
|
|
|
|
|
|
|
| Property | Type | Default | Description |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| `current_log_level` | LogLevel | DEBUG | Minimum log level to display |
|
2026-01-03 09:07:50 +01:00
|
|
|
| `enable_timestamp` | bool | true | Add timestamp to messages |
|
2025-12-21 18:44:38 +01:00
|
|
|
| `save_log` | bool | false | Save logs to file |
|
2026-01-03 09:07:50 +01:00
|
|
|
| `separator` | String | " " | Separator between arguments |
|
2025-12-21 18:44:38 +01:00
|
|
|
| `folder` | String | "" | Directory for log files |
|
|
|
|
|
| `log_filename` | String | "addons/Logs/data.log" | Log file path |
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
```gdscript
|
2026-01-03 09:07:50 +01:00
|
|
|
# Full names
|
|
|
|
|
Log.trace("message", var1, var2)
|
|
|
|
|
Log.debug("message", data)
|
|
|
|
|
Log.info("message")
|
|
|
|
|
Log.warning("message")
|
|
|
|
|
Log.error("message", error_code)
|
|
|
|
|
|
|
|
|
|
# Abbreviated
|
|
|
|
|
Log.t("message", var1)
|
|
|
|
|
Log.d("message", data)
|
|
|
|
|
Log.i("message")
|
|
|
|
|
Log.w("message")
|
|
|
|
|
Log.e("message")
|
|
|
|
|
|
|
|
|
|
# Custom separator
|
|
|
|
|
Log.set_separator(", ")
|
|
|
|
|
Log.info("a", "b", "c") # [INFO ]: a, b, c
|
|
|
|
|
|
|
|
|
|
# One-time separator
|
|
|
|
|
Log.set_separator(" | ", true)
|
|
|
|
|
Log.info("x", "y") # [INFO ]: x | y
|
|
|
|
|
Log.info("a", "b") # [INFO ]: a b
|
2025-12-21 18:44:38 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-03 09:07:50 +01:00
|
|
|
## Output Format
|
2025-12-21 18:44:38 +01:00
|
|
|
|
|
|
|
|
```
|
2026-01-03 09:07:50 +01:00
|
|
|
[HH:MM:SS]|[LEVEL ]: Message # With timestamp
|
|
|
|
|
[LEVEL ]: Message # Without timestamp
|
2025-12-21 18:44:38 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## MIT License
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2025 Vincenzo Gavioli
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
SOFTWARE.
|